http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46680
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |WONTFIX
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-27
14:59:21 UTC ---
(In reply to comment #2)
> >> Am I missing something?
>
> > -O1 / -O2 / -O3 / -Os option.
>
> I know about these optimization flags :).
> My suggestion is directed specifically to -O0.
>
> I would not rest knowing that it generates 4 instructions per comparison,
> while
> it could use 2 instructions, reducing my code size and my compilation time
> while using -O0, which is the default one.
GCC is known to generate very bad code at -O0, but this is expected.
The reason is that GCC makes sure !value is computed into a register
(for the sake of debugging), thus does
temp = !value;
if (temp)
...