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]
Other format: [Raw text]

[Bug fortran/78676] [5/6/7 Regression] Optimizer bug exposed by program with many bit operations


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78676

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-12-05
     Ever confirmed|0                           |1

--- Comment #5 from janus at gcc dot gnu.org ---
Reduced test case:


program testKISS64
  integer, parameter :: Q(2) = [ 393809176, 220190059 ]
  integer :: i, z, carry = 415

  do i=1,2
    z = ishft(ishft(Q(i),9),-1) + &
        ishft(ishft(Q(i),7),-1) + &
        ishft(carry,-1)
    carry = ishft(Q(i),-23) + ishft(Q(i),-25) + ishft(z,-31)
    print *, z, carry
  end do

end program


gfortran 4.7 and 4.8 print at all optimization levels:

  -682598705          58
  1741342173          32

That's also what 4.9 prints at -00 and -01. But then 4.9 (and upwards) print at
-O2 and -O3:

  -682598705          57
  1741342172          32

The error goes away if I remove the loop (even though it occurs already for
i=1).

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