[PATCH]: Integrate gfortran with MPC
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Thu May 28 23:08:00 GMT 2009
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
> From: "Steve Kargl" <sgk@troutmask.apl.washington.edu>
>>
>> BTW, once mpc becomes mandatory, I plan to change gfc_expr as
>> follows:
>>
>> troutmask:sgk[225] diff -u gfortran.h.orig gfortran.h
>> --- gfortran.h.orig 2009-05-26 10:06:24.000000000 -0700
>> +++ gfortran.h 2009-05-26 10:09:03.000000000 -0700
>> @@ -1613,11 +1613,7 @@
>>
>> mpfr_t real;
>>
>> - struct
>> - {
>> - mpfr_t r, i;
>> - }
>> - complex;
>> + mpc_t complex;
>>
>> struct
>> {
So I toyed with doing this conversion myself and the testcase
gfortran.dg/real_const_3.f90 started failing on lines 45 and 48. I traced
it to the compile-time evaluation of these variables. I think it happens in
gfc_arith_divide.
complex :: z = (-0.1,-2.2)/(0.0,0.0)
complex :: z2 = (0.1,1)/0
The above lines currently transform into NaN in gfortran and that's what the
testcase expects. MPC, MPFR (and C) turn finite/zero into Inf. Only
zero/zero turns into NaN.
I'm wondering if it was really meant for fortran to be different, or is this
a bug accidentally immortalized in the testcase? I.e. what does the fortran
standard say?
Thanks,
--Kaveh
More information about the Gcc-patches
mailing list