Bug 23097 - [4.0/4.1 Regression] non-printable output from write with certain formats
Summary: [4.0/4.1 Regression] non-printable output from write with certain formats
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-27 17:18 UTC by Gregorgy Rogers
Modified: 2005-07-27 17:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregorgy Rogers 2005-07-27 17:18:26 UTC
[casper@ARROW test_blas]$ ~/GREG/bin_gcc/bin/gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc4/configure --prefix=/home/casper/GREG/bin_gcc --
mandir=/home/casper/GREG/objdir/share/man --enable-
languages=c,c++,f95,java,objc --enable-shared --enable-threads=posix --with-
mpfr=/home/casper/GREG/f90_prereq --with-gmp=/home/casper/GREG/f90_prereq : 
(reconfigured) ../gcc4/configure --prefix=/home/casper/GREG/bin_gcc --enable-
threads --with-gmp=/home/casper/GREG/f90_prereq --with-
mpfr=/home/casper/GREG/f90_prereq
Thread model: posix
gcc version 4.1.0 20050719 (experimental)
[casper@ARROW test_blas]$ uname -a
Linux ARROW 2.4.20-8bigmem #1 SMP Thu Mar 13 17:32:29 EST 2003 i686 i686 i386 
GNU/Linux
[casper@ARROW test_blas]$ cat test_io.f90
PROGRAM TEST_IO
  INTEGER :: A = 12, B = 109
  ! actual data not important

  WRITE(*,100)A,B
  WRITE(*,101)A,B
  100 FORMAT(/,2X,I5,/2X,I5)
  101 FORMAT(2(/,3X,I5))
END PROGRAM TEST_IO
[casper@ARROW test_blas]$ ~/GREG/bin_gcc/bin/gfortran test_io.f90 -static
[casper@ARROW test_blas]$ ./a.out

     12
  109

      12
  109


-----------------------------------------------------------------
As you can see this is the expected normal behavior, but if you redirect the 
output by either piping to something like less, or to a file then editing with 
say:

[casper@ARROW test_blas]$ ./a.out > junk; vi junk

the file becomes:

     12
^@^@  109

      12
^@^@^@  109

------------------------------------------------------------------
the ^@ characters are supposed to be the blanks that the #X outputs.  As you 
can see it prints some odd character instead.  This only happens after you 
make a newline with /, otherwise it works as normal.  If you have a single 
format statement with multiple /2X statements like format 101 above, the first 
one works correctly, all others after this exibit the bug.
Comment 1 Andrew Pinski 2005-07-27 17:30:58 UTC
Fixed already.
Comment 2 Andrew Pinski 2005-07-27 17:31:36 UTC
This works with 4.1.0 20050727.