Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Brad Lucier <lucier@math.purdue.edu>
To: axp-list@redhat.com
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha
Date: Tue, 17 Apr 2001 23:32:42 -0500 (EST)	[thread overview]
Message-ID: <200104180432.XAA03440@zakon.math.purdue.edu> (raw)
In-Reply-To: <3ADCF1E0.66BCA4AB@voicenet.com> from "Uncle George" at Apr 17, 2001 09:46:08 PM

> 
> with -O2 i get the wrong answer
> 
>                 [gat@LX gat]$ gcc -g -O2 a.c -o a
>                 [gat@LX gat]$ ./a
>                 FlooR: x = 22.16, i0=1, i1=536871996
> 
> 
> with -O i get a passable answer
> 
>                 [gat@LX gat]$ gcc -g -O a.c -o a
>                 [gat@LX gat]$ ./a
>                 FlooR: x = 22.16, i0=1077291253, i1=-1030792151

In ISO C, the compiler can assume that the address of a real is not
the same as the address of an int, and gcc does so unless you give
the -fno-strict-aliasing flag:

popov-9% gcc -v
Reading specs from /export/u10/egcs-test/lib/gcc-lib/alphaev6-unknown-linux-gnu/3.1/specs
Configured with: ../configure --prefix=/export/u10/egcs-test --enable-checking=no --enable-shared=no
gcc version 3.1 20010415 (experimental)
popov-10% gcc -O2 -o a a.c
popov-11% ./a
FlooR: x = 22.16, i0=1, i1=536871788
popov-12% gcc -O2 -fno-strict-aliasing -o a a.c
popov-13% ./a
FlooR: x = 22.16, i0=1077291253, i1=-1030792151

So it may not be a bug.

Brad




  parent reply	other threads:[~2001-04-18  4:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-18  1:46 gcc 2.96 optimization bug on RedHat7.0/alpha Uncle George
2001-04-18  0:04 ` Christopher C. Chimelis
2001-04-18  3:41 ` Matt Wilson
2001-04-18  4:32 ` Brad Lucier [this message]
2001-04-18 15:13   ` Uncle George
2001-04-18 13:40     ` Pawel Salek
2001-04-18 15:53       ` Uncle George
2001-04-18 14:03     ` David Woodhouse
2001-04-18 17:10       ` Uncle George
2001-04-18 15:40         ` Pawel Salek
2001-04-18 16:17         ` David Woodhouse
2001-04-18 16:46         ` Andrew A. Gill
2001-04-18 17:04           ` T. Daniel Crawford
2001-04-18 18:15             ` Nelson Brito
2001-04-18 18:38         ` jeff.sturm
2001-04-18 14:55     ` Michal Jaegermann
2001-04-18 22:18       ` Uncle George
2001-04-18 20:50         ` Chris Eleveld (Sector 7 Group)
2001-04-18 21:33         ` Michal Jaegermann
2001-04-18 23:09           ` P.TURLAIS
2001-04-19  0:28           ` Uncle George
2001-04-18 22:03         ` jeff.sturm
  -- strict thread matches above, loose matches on Subject: below --
2001-04-18 16:22 Hoover, Tony
2001-04-18 16:55 ` David Woodhouse
2001-04-18 17:07 ` alvin
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox