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 PR20086 -- missing characters in hollerithconstant


a hollerith constant can have a little 'h', as well as a big 'H', as the
starting delimiter.

the code assumed that it was always a 'H'.

testcase below that fails before and passes after this patch is applied.


no regressions, tested i686/gnu/linux.


--bud


2004-02-20  Bud Davis  <bdavis@gfortran.org>

	PR fortran/20086
	* io/transfer.c (write_constant_string): accept an 'h' as
	the start of a hollerith format string.


! { dg-do run }     
! PR 20086 - Missing characters in output with hollerith strings
      implicit none
      character*80 line
      write(line,2070)
      if (line.ne.'  stiffness reformed for this high step')call abort
      write(line,2090)
      if (line.ne.'  stiffness reformed for hello hello')call abort 
      stop

 2070  format (2x,37hstiffness reformed for this high step)
 2090  format (2x,34hstiffness reformed for hello hello)

      end
? gcc/libgfortran/io/transfer.c.bud
Index: gcc/libgfortran/io/transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/transfer.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 transfer.c
*** gcc/libgfortran/io/transfer.c	29 Jan 2005 15:45:17 -0000	1.31
--- gcc/libgfortran/io/transfer.c	19 Feb 2005 21:46:03 -0000
*************** write_constant_string (fnode * f)
*** 386,392 ****
    for (; length > 0; length--)
      {
        c = *p++ = *q++;
!       if (c == delimiter && c != 'H')
  	q++;			/* Skip the doubled delimiter.  */
      }
  }
--- 386,392 ----
    for (; length > 0; length--)
      {
        c = *p++ = *q++;
!       if (c == delimiter && c != 'H' && c != 'h')
  	q++;			/* Skip the doubled delimiter.  */
      }
  }





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