This is the mail archive of the 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

From: "Kaveh R. Ghazi" <>

From: "Steve Kargl" <>

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;


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?


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