http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53616

Vladimir Yakovlev <vbyakovl23 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vbyakovl23 at gmail dot com

--- Comment #11 from Vladimir Yakovlev <vbyakovl23 at gmail dot com> 2012-07-23 
12:53:13 UTC ---
Miscompare in 416 .games is caused by a wrong transformation of a loop in file
grd2b.f, lines 113-121.

      DO 110 M=1,3
        P12(M,1)= C(M,IAT)
        P12(M,2)= C(M,JAT)
        P12(M,3)= P12(M,2)-P12(M,1)
      R12= R12+P12(M,3)*P12(M,3)
         P34(M,1)= C(M,KAT)
         P34(M,2)= C(M,LAT)
         P34(M,3)= P34(M,2)-P34(M,1)
  110 R34= R34+P34(M,3)*P34(M,3)

After transformation we have

      P12(:,1) = C(:,IAT)
      P12(:,2) = C(:,jAT)
      DO 110 M=1,3
        P12(M,3)= P12(M,2)-P12(M,1)
      R12= R12+P12(M,3)*P12(M,3)
         P34(M,3)= P34(M,2)-P34(M,1)
  110 R34= R34+P34(M,3)*P34(M,3)
      P34(:,1) = C(:,KAT)
      P34(:,2) = C(:,LAT)

That is we changed order of operators in the loop. Right transformation should
be

      P12(:,1) = C(:,IAT)
      P12(:,2) = C(:,jAT)
      DO 110 M=1,3
        P12(M,3)= P12(M,2)-P12(M,1)
  110   R12= R12+P12(M,3)*P12(M,3)
      P34(:,1) = C(:,KAT)
      P34(:,2) = C(:,LAT)
      DO 111 M=1,3
         P34(M,3)= P34(M,2)-P34(M,1)
  111 R34= R34+P34(M,3)*P34(M,3)

I attached a reduced test case and dumps with and without transformations.
Command line to compile is 

gfortran   m.f t.f -O3
The result of run is differed from a result of code compiled with -O0 opt
level.
I used compiler

Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --with-arch=corei7 --with-cpu=corei7
--enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld
--enable-cloog-backend=isl --with-fpmath=sse --enable-languages=c,c++,fortran
--enable-bootstrap=no
Thread model: posix
gcc version 4.8.0 20120606 (experimental) (GCC)

Reply via email to