This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc over-optimizes "volatile double"
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc over-optimizes "volatile double"
- From: "Thomas R. Truscott" <trt at cs dot duke dot edu>
- Date: Wed, 2 Aug 2000 16:06:58 -0400 (EDT)
In ss-20000724 i686-pc-linux (and since sometime this year)
a "gcc -O" keeps "volatile double" in a floating point
register, which causes the program below to abort()
because on ia32 floating point registers have more
precision than "double".
I realize that gcc has the -ffloat-store option,
but IMO volatile should imply this.
Tom Truscott
volatile double zg;
int
main (void)
{ double eps, t;
volatile double z;
eps = 1;
for (;;)
{
t = eps / 2;
z = 1 + t;
if (z == 1)
break;
eps = t;
}
zg = 1 + eps;
if (zg == 1)
abort();
exit (0);
}