This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Integrate gfortran with MPC
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: "Steve Kargl" <sgk at troutmask dot apl dot washington dot edu>
- Cc: "Tobias Burnus" <burnus at net-b dot de>, <fortran at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 May 2009 16:04:41 -0700
- Subject: Re: [PATCH]: Integrate gfortran with MPC
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