This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] patch PR 20660
- From: Walt Brainerd <walt at fortran dot com>
- To: François-Xavier Coudert<Francois-Xavier dot Coudert at lcp dot u-psud dot fr>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Mar 2005 08:56:19 -0700
- Subject: Re: [gfortran] patch PR 20660
- References: <42493094.3090203@lcp.u-psud.fr>
François-Xavier Coudert wrote:
The attached trivial patch fixes PR libfortran/20660 (INQUIRE by unit
number reported wrong EXIST value).
Fortran details: if I understand correctly, INQUIREing the EXISTence
of a given unit number should always be TRUE since gfortran can open
any arbitrary unit number.
A unit number must be nonnegative, so it would be better
to return false for a negative number. But this is much better
than it was, as people (eg me) use it to find an available unit
# to use in an open statement by finding a unit that exists
and is not connected (rational people would probably start
the hunt at 11, or some such number, so it will work for
most as is).
In trying this, I found a couple of other oddities that I will send.
They would be pretty far down the list of things to fix, I would think.
*strapped and regtested on (i686-linux) for both 4.0 and mainline . OK?
2005-03-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20660
* io/inquire.c (inquire_via_unit): EXIST should always be TRUE.
2005-03-29 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/20660
* gfortran.dg/pr20660.f: New test.
------------------------------------------------------------------------
Index: libgfortran/io/inquire.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/inquire.c,v
retrieving revision 1.9
diff -p -u -r1.9 inquire.c
--- libgfortran/io/inquire.c 30 Jan 2005 13:16:19 -0000 1.9
+++ libgfortran/io/inquire.c 29 Mar 2005 10:33:52 -0000
@@ -46,7 +46,7 @@ inquire_via_unit (gfc_unit * u)
const char *p;
if (ioparm.exist != NULL)
- *ioparm.exist = (u != NULL);
+ *ioparm.exist = 1;
if (ioparm.opened != NULL)
*ioparm.opened = (u != NULL);
------------------------------------------------------------------------
! PR libfortran/20660
! {dg-do run}
integer k
logical ck
do k = 1, 20
inquire(unit=k, exist=ck)
if (.not. ck) call abort
end do
end
--
Walt Brainerd +1-877-355-6640 (voice & fax)
The Fortran Company +1-520-760-1397 (outside USA)
6025 N. Wilmot Road walt@fortran.com
Tucson, AZ 85750 USA http://www.fortran.com