In the following Fortran program, the variable "foo" is never used, it is only
set.

Result: Using "gfortran -O3", "foo" is not optimized away.
Expected: "foo" is optimized away as it happens with "ifort -O2".

      program a
      implicit none
      integer*8 it,two
      parameter(it=1073741824,two=2)
      complex foo(it*two-1)

      foo(10)=1.
      write(*,*) ''
      end program a


-- 
           Summary: Optimize away only set but not used variable
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to