5 ms·
Again: There really needs to be a warning (elevate-able to an error like usual) for all removed / "optimized out" code. A programmer added it for a reason, and
by mjevans 7y ago
Again: There really needs to be a warning (elevate-able to an error like usual) for all removed / "optimized out" code. A programmer added it for a reason, and either that reason is invalid and it can be removed OR the compiler's doing something the programmer did not intend and is thus exhibiting undesired behavior.
- saagarjha 7y agoSo you’re looking for a warning that will always show up in any non-trivial program?
- ogoffart 7y agoThis is not possible. void foo(int x) { if (x) do_something(); else do_something_else(); } void fn1() { foo(0); } void fn2() { foo(1); } When the code is inlined, the compiler can propagate constant and optimize the `if`. Do you really expect two warnings there? These warning would happen all the time. And anyway, this does not apply to this particular bug which is just a compiler bug (which has been fixed). The warning was there all along: This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- tinus_hn 7y agoThis is a bug, not optimization.