This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Integrate gfortran with MPC


On Thu, May 28, 2009 at 04:04:41PM -0700, Kaveh R. Ghazi wrote:
> 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?
> 

Andrew's correct in that the Fortran standard does not
address Inf or NaN unless one is using Fortran 2003's
IEEE intrinsic module. 

I suspect that this is bug that has been immortalized in
the testsuite.  It should probably be fixed to give the
result that an equivalent C program would give.  Can you
open a bug report and add me to cc?

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]