This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc over-optimizes "volatile double"


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);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]