consider the following program
        program short_test_inf
        complex*16 nan_inf, normal_number, cmplx_test
        real*8 tth, pi, zero
        data tth /6.66666666666666667D-01/
        data pi  /3.1415926535897932385D0/
        data  zero /0.0D0/
        normal_number = dcmplx(tth, zero)   
        nan_inf       = dcmplx(pi/zero, zero/zero)
        cmplx_test = nan_inf * normal_number
        print *,'nan_inf ',nan_inf
        print *,'cmplx_test (inf+iNan)*(2/3+i0) ',cmplx_test
        cmplx_test = nan_inf * tth
        print *,'tth ',tth
        print *,'cmplx_test  (inf+iNan)*(2/3)',cmplx_test
        end program

optimized version (gfortran -O test.F)
returns
 nan_inf  (                +Infinity,                      NaN)
 cmplx_test (inf+iNan)*(2/3+i0)  (                +Infinity,                   
  NaN)
 tth   0.66666666666666663     
 cmplx_test  (inf+iNan)*(2/3) (                +Infinity,                     
NaN)

non optimized version (gfortran test.F)
returns
 nan_inf  (                +Infinity,                      NaN)
 cmplx_test (inf+iNan)*(2/3+i0)  (                      NaN,                   
  NaN)
 tth   0.66666666666666663     
 cmplx_test  (inf+iNan)*(2/3) (                      NaN,                     
NaN)

Note: gfortran4.2.3 returns for both (optimized/non optimized) NaN, NaN
intel 10 fortran has exactly the same behaviour as gfortran 4.3.0:
optimized Inf,NaN
non optimized Inf,Nan
thanks


-- 
           Summary: difference between result in optimized and normal
                    executable
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dmarkman at mac dot com


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

Reply via email to