Indeed, I can see how the compiler got there. But I kind of wish there was a C compiler that flatly refuses to build undefined code.
-
-
I can't edit the code on my phone :-( Any change if you explicitly initialize to zero? (I'd think not) Does gcc do the same?
-
Currently on my phone only too...
-
Telling clang to compile as C changes nothing, which is weird as I don't know what could call NeverCalled without static constructors.
-
I think the logic only collects all value setters, disregarding callability of setter sites.
-
But making the function static (no possibility of unseen callers) changes the tail call of system() to unconditional "crash me".
-
This might be a side effect of unreachable code elimination.
End of conversation
New conversation -
-
-
The problem with that is *nothing* would compile. The world is full of C code that doesn't execute UB but the compiler can't prove doesn't.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I have a vague hope it might not do it if neverCalled() is static — no possibility of unseen other code calling it.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.