This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH]: Integrate gfortran with MPC
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers 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 21:09:35 -0700
- Subject: Re: [PATCH]: Integrate gfortran with MPC
- References: <B893CE4B787949BDB96C7366FEA4CA8C@glap>
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