3 ms·
The number of people who want the language and compiler implementation you are describing is vanishingly small.
by BeeOnRope 6y ago
The number of people who want the language and compiler implementation you are describing is vanishingly small.
- kazinator 6y agoThe number of people who are burned because of what implementation they actually have is not so small.
- nkurz 6y agoSmall, but vocal! I think I share kazinator's preferences here. For a C++ compiler, maybe you need dead code elimination. But for C, I'd prefer a warning accompanied by reliable execution.
- BeeOnRope 6y agoI think people underestimate the extent to which things like "dead code" elimination matter. Basic, table stakes optimizations like constant propagation and inlining result in a ton of scenarios like the if (0) { } thing the GP mentions, even if such constructs don't explicitly appear in the code. People know what they don't like and so they logically suggest that this optimization should not occur, but it is hard to understand the extent by which this type of optimization is helpful in other places and perhaps how it is intertwined with other useful optimizations.
- kazinator 6y agoDead code elimination based on iron-clad truths is important; truths like constant expressions, or expressions that evaluate true due to the range of a type or whatever. Elimination of some code block B based on some cockamamie hypothesis about some statement A being well-defined is not important.
- BeeOnRope 6y agoMaybe that single optimization is not particularly important. In any case, you can turn it off with - fno-delete-null-pointer-checks, although I'd recommend against accessing null pointers in any case (you are often at the mercy of the optimizer anyway: hoping it generates non-trapping code).