[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

gcc -mieee-with-inexact on ev67 gives wrong results


I tried to run the following test program on an alpha ev67 (a Nautilus
running debian potato with linux-2.2.17, gcc-2.95.2):

#include <stdio.h>

int main (int argc, char *argv[])
  double a, b, c; 

  a = 1.; 
  b = 3.; 
  c = a/b; 

  fprintf (stderr, "%g / %g = %g\n", a, b, c); 

Whenever the -mieee-with-inexact flag is set when compiling with gcc,
the program gives an incorrect result (c=0.25 instead of 0.333333). I
wasn't able to reproduce this behaviour with either g77 or the Compaq
compilers (fort, ccc), setting the appropriate option.

The hardware (mainboard+cpu) of the computer has been changed
recently, so that is probably not the problem.

I suspect that this is not a glibc problem because setting the
-D_IEEE_FP and -D_IEEE_FP_INEXACT flags without -mieee-with-inexact
did not produce the wrong result.

Currently, I have no access to any other ev67. All other alphas I have
access to (ev4, ev45, ev56) give correct results.

Has anyone else had similar problems? Is this really a gcc bug? Any
input is greatly appreciated.


Major Andras
    e-mail: andras@users.sourceforge.net
    www:    http://andras.webhop.org/

Reply to: