Hacker News new | past | comments | ask | show | jobs | submit login

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.



This 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.


So you’re looking for a warning that will always show up in any non-trivial program?


This is a bug, not optimization.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: