Since when does GCC *assume* the program to be correct?
Posted Apr 18, 2008 19:15 UTC (Fri) by
brouhaha (guest, #1698)
In reply to:
Since when does GCC *assume* the program to be correct? by nix
Parent article:
GCC and pointer overflows
There's a big difference between the (a + foo < a) and (sizeof (a) < 1) cases, which is that the former is something that a programmer is likely to code specifically because he or she knows that the program might (unintentionally) be buggy, in an attempt to catch a bug, while the latter is unlikely to occur at all, and certainly not as something a programmer is likely to deliberately test for.
If it decided that, oh,
that could be true after all, it's choosing an interpretation which the
Standard forbids.
Yet which can actually quite easily happen in real programs. NOWHERE does the standard say that a compiler has to optimize away tests that might always have a fixed value for valid programs, but might easily have differing values for buggy programs.
Perhaps we should spell 'while' differently
when the locale is de_DE?
You've lost me here. I don't see any way that a purely semantic error in a program could result in "while" being misspelled, even if the locale is de_DE.
(
Log in to post comments)