re PR libfortran/15311 (Incorrect handling of A edit descriptor)
authorBud Davis <bdavis9659@comcast.net>
Sat, 15 May 2004 18:35:39 +0000 (18:35 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Sat, 15 May 2004 18:35:39 +0000 (18:35 +0000)
PR fortran/15311
* io/write.c (write_a): right justify A edit output.
libgfortran/
* gfortran.fortran-torture/execute/write_a_1.f90: New test.

From-SVN: r81895

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/write_a_1.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/write.c

index c1a37d6da8f46f2d8646cd02a8f2d2f7cb94fbb2..3f543a2e15a9d869a4ae51446bbd96e961f1c798 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-15  Bud Davis  <bdavis9659@comcast.net>
+
+       PR fortran/15311
+       * gfortran.fortran-torture/execute/write_a_1.f90: New test.
+
 2004-05-15  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/13826
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/write_a_1.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/write_a_1.f90
new file mode 100644 (file)
index 0000000..18cb103
--- /dev/null
@@ -0,0 +1,14 @@
+! pr 15311
+! output with 'A' edit descriptor
+      program write_a_1
+      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 bbf22d4d08228a0a33b6448daccd95908e677ce9..2ebef7f2d1b137b2009fd38407d55d39aecba296 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-15  Bud Davis  <bdavis9659@comcast.net>
+
+       PR fortran/15311
+       * io/write.c (write_a): right justify A edit output.
+
 2004-05-14  Bud Davis  <bdavis9659@comcast.net>
 
        PR fortran/15149
index dd44f6e5f729015c73a51819f3e976e19229e627..05dbd9bb789f09f0a814744731d46f568ae93249 100644 (file)
@@ -50,8 +50,8 @@ write_a (fnode * f, const char *source, int len)
     memcpy (p, source, wlen);
   else
     {
-      memcpy (p, source, len);
-      memset (p + len, ' ', wlen - len);
+      memset (p, ' ', wlen - len);
+      memcpy (p + wlen - len, source, len);
     }
 }