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]

[gfortran] patch for PR 14837 - INQUIRE by file returns incorrectresults.


This corrects the PR and NIST tests FM919.FOR FM920.FOR.

The search for a matching file in the unit data structure was always
failing because something other than a file descriptor 
was being used in a call to fstat.

No additional test suite failures, i686/gnu/linux.  The below test fails
before and passes after the application of this patch.


--bud


inquire_2.f90

! PR 14837
      INTEGER UNIT
      OPEN(FILE='CSEQ', UNIT=23)
      INQUIRE(FILE='CSEQ',NUMBER=UNIT)
      IF (UNIT.NE.23) CALL ABORT
      END


 
2004-04-02  Bud Davis  <bdavis9659@comcast.net>
 
        PR fortran/14837
        * io/unix.c (find_file0): Use fd field of struct.

Index: gcc/libgfortran/io/unix.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/Attic/unix.c,v
retrieving revision 1.1.2.4
diff -c -3 -p -r1.1.2.4 unix.c
*** gcc/libgfortran/io/unix.c   19 Sep 2003 19:11:12 -0000      1.1.2.4
--- gcc/libgfortran/io/unix.c   3 Apr 2004 22:55:23 -0000
*************** find_file0 (unit_t * u, struct stat *st1
*** 1117,1123 ****
    if (u == NULL)
      return NULL;
   
!   if (fstat (((unix_stream *) u)->fd, &st2) >= 0 &&
        st1->st_dev == st2.st_dev && st1->st_ino == st2.st_ino)
      return u;
   
--- 1117,1123 ----
    if (u == NULL)
      return NULL;
   
!   if (fstat (((unix_stream *) u->s)->fd, &st2) >= 0 &&
        st1->st_dev == st2.st_dev && st1->st_ino == st2.st_ino)
      return u;
   





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