This program works Ok on the Macintosh. On linux this program fails with -O2,
but works Ok with -g -


dir/tests> gfortran -O2 -o timefun02 timefun02.f
dir/tests> timefun02
 Error    1.00000000000000        1.00000000000000
STOP 0
dir/tests> gfortran -g -o timefun02 timefun02.f
dir/tests> timefun02
STOP 0
dir/tests> cat timefun02.f
      program main
      implicit real*8 (a-h,o-z)
      time2=0d0
      do 20 i=1,10
      time2 = time2 + 0.1d0
   20 continue
      call sub1(time2)
      stop
      end
      subroutine sub1(time)
      implicit real*8 (a-h,o-z)
      time2=0d0
      do 30 i=1,10
      time2 = time2 + 0.1d0
  30  continue
      if(time2.ne.time)then
         write(6,*)'Error ',time2,time
      endif
      return
      end

dir/tests> gfortran --v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/home/dir/gfortran 
--enable-languages=c,f95
Thread model: posix
gcc version 4.1.0 20050815 (experimental)

-- 
           Summary: program works correctly with -g option but fails with -
                    O2 option on LINUX
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dir at lanl dot gov
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to