GCC-4 compiler bug

Jeremy Messenger mezz7 at cox.net
Wed Nov 28 19:42:27 PST 2007


On Wed, 28 Nov 2007 19:57:15 -0600, Matthew D. Fuller wrote:

> On Wed, Nov 28, 2007 at 05:58:31AM +0000 I heard the voice of Jeremy
> Messenger, and lo! it spake thus:
>> 
>> % cc test.c -o test
> 
> Note Simon's mail:
> 
>> Important to note is that this only happens when compiling with
>> optimization (they claim).

Yeah, I get that same result if add optimization. Daniel's suggest of add 
-fwrapv seems to solve this problem.

% cc -O2 -fwrapv -o test test.c
% ./test
X

Cheers,
Mezz

> % cc -o test test.c
> % ./test
> X
> % cc -O -o test test.c
> % ./test
> X
> % cc -O2 -o test test.c
> % ./test
> %
> 
> gcc version 4.2.1 20070719  [FreeBSD]






More information about the Kernel mailing list