[gfortran] patch for NIST FM413.FOR test failure

Bud Davis bdavis9659@comcast.net
Sun Nov 28 19:39:00 GMT 2004


the failure using a direct access file:

           write every other record in ascending RECL order.
           write the skipped record in descending RECL order.

in descending order, a short sequence of records would not be written.



This corrects FM413.FOR, and changes FM912.FOR from a segfault to a
FAIL.

No additional testsuite regressions, tested i686/gnu/linux/FC2




--bud


! this testcase derived from NIST test FM413.FOR
      PROGRAM FM413
      IMPLICIT LOGICAL (L)
      IMPLICIT CHARACTER*14 (C)
C
      I10 = 9
      IPROG = 413
      IFILE = I10
      ITOTR = 214
      IRLGN = 80
      IRECN = 0
      IEOF = 0
      IVTNUM =   1
      IVCORR = 1
      IVCOMP = 0
      OPEN ( I10, ACCESS = 'DIRECT', RECL = 80, STATUS='REPLACE' )
      IVTNUM =  16
      IRECN = 13
      IREC = 13
      DO 4132 I = 1,100
      IREC = IREC + 2
      IRECN = IRECN + 2
      WRITE (I10, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,
     1   ICON21, ICON22, ICON31, ICON32, ICON33, ICON34, ICON55, ICON56
 4132 CONTINUE
      IVTNUM =  17
      IRECN = 216
      IREC = 216
      IVCOMP = 0
      DO 4133 I=1,7
      IREC = IREC - 2
      IRECN = IRECN - 2
      WRITE (I10, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,
     1   ICON21, ICON22, ICON31, ICON32, ICON33, ICON34, ICON55, ICON56
      IVCOMP = IVCOMP + 1
 4133 CONTINUE
      IVTNUM =  32
      IRECCK = 13
      IRECN = 0
      IREC = 13
      IVCOMP = 0
      DO 4134 I = 1,100
      IREC = IREC + 2
      IRECCK = IRECCK + 2
      READ (I10, REC = IREC) IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,
     1   IVON21, IVON22, IVON31, IVON32, IVON33, IVON34, IVON55, IVON56
      IF (IRECN .NE. IRECCK) CALL ABORT
 4134 CONTINUE
      IVTNUM =  33
      IRECCK = 216
      IRECN = 0
      IVCOMP = 0
      IREC = 216
      DO 4135 I = 1,7
      IREC = IREC - 2
      IRECCK = IRECCK - 2
      READ (I10, REC = IREC)  IPROG, IFILE, ITOTR, IRLGN, IRECN, IEOF,
     1   IVON21, IVON22, IVON31, IVON32, IVON33, IVON34, IVON55, IVON56
      IF (IRECN .NE. IRECCK) CALL ABORT
 4135 CONTINUE
      STOP
      END

    
   

Index: gcc/libgfortran/io/unix.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 unix.c
*** gcc/libgfortran/io/unix.c	30 Oct 2004 16:23:23 -0000	1.13
--- gcc/libgfortran/io/unix.c	28 Nov 2004 18:35:50 -0000
*************** mmap_alloc_w_at (unix_stream * s, int *l
*** 667,673 ****
      }
  
    if ((s->buffer == NULL || s->buffer_offset > where ||
!        where + *len > s->buffer_offset + s->active) &&
        mmap_alloc (s, where, len) == FAILURE)
      return NULL;
  
--- 667,674 ----
      }
  
    if ((s->buffer == NULL || s->buffer_offset > where ||
!        where + *len > s->buffer_offset + s->active ||
!        where < s->buffer_offset + s->active) &&
        mmap_alloc (s, where, len) == FAILURE)
      return NULL;
  

2004-11-28  Bud Davis  <bdavis9659@comcast.net>

	* io/unix.c (mmap_alloc_w_a): check for a write to
	a location less than the mapped area.




More information about the Gcc-patches mailing list