incorrect optimization of ((i < 0) && (i >= 0)) [egcs-1.1.1]

Nathan Sidwell nathan@acm.org
Sun Feb 28 23:30:00 GMT 1999


Dan Yergeau wrote:
> 
> The first expression (i.e. ((i < 0) && (i >= 0))) in the following
> test program evaluates to 1 if -O1 or higher is used.  The result
> should be 0 (as it is with -O0).
> 
> This happens with "gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)"
> on various platforms including i386-unknown-freebsdelf3.0 and
> sparc-sun-solaris2.5.1.
It is still present in the 19990131 snapshot

nathan@manao:298>uname -a
SunOS manao 5.6 Generic_105181-03 sun4u sparc SUNW,Ultra-5_10
nathan@manao:299>ss-gcc -v       
Reading specs from
/local/nathan/ss/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.04/specs
gcc version egcs-2.93.04 19990131 (gcc2 ss-980929 experimental)
nathan@manao:300>ss-gcc foo.c -O0
nathan@manao:301>a.out
0
0
0
0
nathan@manao:302>ss-gcc foo.c -O1
nathan@manao:303>a.out           
1
0
0
0

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc-bugs mailing list