[PATCH]gfortran-PR14308 mangling of H edit

Bud Davis bdavis9659@comcast.net
Fri Feb 6 05:34:00 GMT 2004


This patch corrects PR 14308.  

The character 'H' in hollerith edit descriptors were being deleted. This
is not needed for hollerith formats.

Testcases:

This testcase is written in F77. It does not work with gfortran at this
time because internal writes appear to be broken.

C PR 14308- 'H' in hollerith causes mangling of string
      IMPLICIT NONE
      CHARACTER*4 LINE
 100  FORMAT (4H12H4)
      WRITE(LINE,100)
      IF (LINE.NE.'12H4') THEN
           PRINT*,'The string written was ',LINE,' should be 12H4'
           CALL ABORT
      ENDIF
      END

The example provided with the PR does work correctly with this patch,
however I do not know how to handle PASS/FAIL on a test that writes to
stdout.

Example from PR:


 100  FORMAT (1H ,10X,38HFOR OFFICIAL USE ONLY - COPYRIGHT 1978)
      WRITE(6,100)
      END


Changelog:

2004-04-05  Bud Davis <bdavis9659@comcast.net>

* transfer.c (write_constant_string): Do not delete H's in hollerith
formats.


Testing:
Tested on i686-pc-gnu-linux with no additional testsuite failures.



regards,
bud davis



Index: gcc/libgfortran/io/transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/Attic/transfer.c,v
retrieving revision 1.1.2.6
diff -c -3 -p -r1.1.2.6 transfer.c
*** gcc/libgfortran/io/transfer.c	1 Jan 2004 13:57:04 -0000	1.1.2.6
--- gcc/libgfortran/io/transfer.c	6 Feb 2004 04:53:02 -0000
*************** write_constant_string (fnode * f)
*** 340,346 ****
    for (; length > 0; length--)
      {
        c = *p++ = *q++;
!       if (c == delimiter)
  	q++;			/* Skip the doubled delimiter */
      }
  }
--- 340,346 ----
    for (; length > 0; length--)
      {
        c = *p++ = *q++;
!       if (c == delimiter && c != 'H')
  	q++;			/* Skip the doubled delimiter */
      }
  }




More information about the Gcc-patches mailing list