This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [testsuite gfortran] partial fix for secnds*.f


> That would clearly be a bug for gcc or gfortran.

Cannot tell for gcc, but it is for gfortran:

[karma] bug/timing% cat anint4.f90
      real function anint4(x)
      real, parameter :: f = 2.0**23, f1 = 2.0**23 , f2 = 2.0**23
      real, parameter :: f3 = 2.0**23 , f4 = 2.0**23
      real x, a, b, c, d, e
      anint4 = x
      a = abs(x)
      if (a < f) then                             ! x is an integer
         anint4 = (f+a) - f
         print *, a, anint4
         if ((anint4 - 0.5) > a) then
            anint4 = anint4 - 1.0 
         else
            if ((anint4 + 0.5) > a) then
            else
               anint4 = anint4 + 1.0
            end if
         end if
         if (x > -0.5) return
         anint4 = -anint4
      end if
      end function anint4

[karma] bug/timing% gfc -c -fdump-tree-optimized -O3 anint4.f90
[karma] bug/timing% cat anint4.f90.119t.optimized
...
  if (a.3 < 8.388608e+6)
    goto <bb 3>;
  else
    goto <bb 9> (<L13>);

<bb 3>:
  __result_anint4 = (a.3 + 8.388608e+6) - 8.388608e+6;
...
[karma] bug/timing% gfc -c -fdump-tree-optimized -O3 -ffast-math anint4.f90
[karma] bug/timing% cat anint4.f90.119t.optimized 
...
  if (a.3 < 8.388608e+6)
    goto <bb 3>;
  else
    goto <bb 9> (<L13>);

<bb 3>:
  __result_anint4 = a.3 + 0.0;
...

Using built-in specs.
Target: powerpc-apple-darwin7
Configured with: ../gcc-4.3-20070526/configure --prefix=/sw --prefix=/sw/lib/gcc4 --disable-multilib --enable-languages=c,c++,fortran,objc --infodir='/sw/lib/gcc4/share/info' --with-gmp=/sw --with-included-gettext --build=powerpc-apple-darwin7 --host=powerpc-apple-darwin7 --with-as=/sw/lib/odcctools/bin/as --with-ld=/sw/lib/odcctools/bin/ld --with-nm=/sw/lib/odcctools/bin/nm --with-ar=/sw/lib/odcctools/bin/ar --with-strip=/sw/lib/odcctools/bin/strip --with-ranlib=/sw/lib/odcctools/bin/ranlib
Thread model: posix
gcc version 4.3.0 20070525 (experimental)

So if I am not mistaken, -ffast-math does not obey the parentheses.
If you consider this is a bug, I'll fill a bug report.


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