[gfortran] patch for pr 15311, 'A' format descriptor justifies output wrong

Bud Davis bdavis9659@comcast.net
Thu May 13 01:29:00 GMT 2004


tested with no additional failure i686/gnu/linux FC1


--bud


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

	* io/write.c (write_a): right justify A edit output.






! pr 15311
! output with 'A' edit descriptor
      program main
      character*25 s
! string = format
      write(s,'(A11)') "hello world"
      if (s.ne."hello world") call abort
! string < format
      write(s,'(A2)') "hello world"
      if (s.ne."he") call abort
! string > format
      write(s,'(A18)') "hello world"
      if (s.ne."       hello world") call abort
      end


Index: gcc/libgfortran/io/write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/Attic/write.c,v
retrieving revision 1.1.2.9
diff -c -3 -p -r1.1.2.9 write.c
*** gcc/libgfortran/io/write.c	1 Apr 2004 01:32:46 -0000	1.1.2.9
--- gcc/libgfortran/io/write.c	13 May 2004 01:12:39 -0000
*************** write_a (fnode * f, const char *source, 
*** 50,57 ****
      memcpy (p, source, wlen);
    else
      {
!       memcpy (p, source, len);
!       memset (p + len, ' ', wlen - len);
      }
  }
  
--- 50,57 ----
      memcpy (p, source, wlen);
    else
      {
!       memset (p, ' ', wlen - len);
!       memcpy (p + wlen - len, source, len);
      }
  }
  




More information about the Fortran mailing list