From 94161cec950961a9b8f76db8ef0035dd840d542e Mon Sep 17 00:00:00 2001 From: Bud Davis Date: Sat, 15 May 2004 18:35:39 +0000 Subject: [PATCH] re PR libfortran/15311 (Incorrect handling of A edit descriptor) 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 | 5 +++++ .../gfortran.fortran-torture/execute/write_a_1.f90 | 14 ++++++++++++++ libgfortran/ChangeLog | 5 +++++ libgfortran/io/write.c | 4 ++-- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.fortran-torture/execute/write_a_1.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1a37d6da8f..3f543a2e15a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-05-15 Bud Davis + + PR fortran/15311 + * gfortran.fortran-torture/execute/write_a_1.f90: New test. + 2004-05-15 Tobias Schlueter 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 index 00000000000..18cb103cbe7 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/write_a_1.f90 @@ -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 diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index bbf22d4d082..2ebef7f2d1b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2004-05-15 Bud Davis + + PR fortran/15311 + * io/write.c (write_a): right justify A edit output. + 2004-05-14 Bud Davis PR fortran/15149 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index dd44f6e5f72..05dbd9bb789 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -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); } } -- 2.30.2