------- Comment #3 from dmarkman at mac dot com  2008-04-14 21:47 -------
Hi, first of all thanks for your comment
I don't use i0 in the program - it's inside of the quotes
so test is fine
I made all changes you made
and still in 4.3 (opt) I'm getting (+Inf, Nan)
it looks like that 4.4 fixes that Inconsistence
I just don't build 4,4 to check
thanks again

> Well, your test case is invalid anyway (i0 is referenced before being 
> defined).
> 
> Here's a standard conforming portable version that compiles with "-Wall
> -pedantic -std=f2003":
> 
>         program short_test_inf
>         implicit none
>         integer, parameter :: dp = selected_real_kind (15)
>         complex(dp) nan_inf, normal_number, cmplx_test, i0
>         real(dp) tth, pi, zero
>         data tth /6.66666666666666667e-01_dp/
>         data pi  /3.1415926535897932385_dp/
>         data  zero /0.0_dp/
>         normal_number = cmplx(tth, zero, dp)   
>         nan_inf       = cmplx(pi/zero, zero/zero, dp)
>         i0 = cmplx(0, 0, dp)
>         cmplx_test = nan_inf * normal_number
> C        print *,'nan_inf ',nan_inf
>         print *,'cmplx_test (inf+iNan)*(2/3+i0) ',cmplx_test
>         cmplx_test = nan_inf * tth
> C        print *,'tth ',tth
>         print *,'cmplx_test  (inf+iNan)*(2/3)',cmplx_test
>         end program
> 
> Results with this program comparing 4.1 and 4.4 (trunk):
> 
> $ ./gf41-opt 
>  cmplx_test (inf+iNan)*(2/3+i0)  (                    NaN,                   
> NaN)
>  cmplx_test  (inf+iNan)*(2/3) (              +Infinity,                    
> NaN)
> $ ./gf41-nonopt 
>  cmplx_test (inf+iNan)*(2/3+i0)  (                    NaN,                   
> NaN)
>  cmplx_test  (inf+iNan)*(2/3) (                    NaN,                    
> NaN)
> $ ./gf44-opt 
>  cmplx_test (inf+iNan)*(2/3+i0)  (                +Infinity,                  
>  
>   NaN)
>  cmplx_test  (inf+iNan)*(2/3) (                +Infinity,                     
> NaN)
> $ ./gf44-nonopt 
>  cmplx_test (inf+iNan)*(2/3+i0)  (                      NaN,                  
>  
>   NaN)
>  cmplx_test  (inf+iNan)*(2/3) (                      NaN,                     
> NaN)
> 
> Basically, I'd like to close this as wontfix. IIRC once you get an FP
> exception, all bets are off and the result of further computation can be
> anything. Of course it would be nice if results were the same regardless of
> optimization level.
> 
> For a related issue where being excessively anal about complex arithmetic
> resulted in a factor of 5 slowdown, see PR 29549
> 


-- 


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

Reply via email to