Bug 34782 - tab format failure to display properly (regression vs. g77)
tab format failure to display properly (regression vs. g77)
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.3.0
: P3 normal
: ---
Assigned To: Jerry DeLisle
: wrong-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2008-01-14 19:09 UTC by Barry McInnes
Modified: 2008-01-18 22:24 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-01-15 01:18:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barry McInnes 2008-01-14 19:09:59 UTC
Sample test failure. Works on Sun Compiler, Mac g95 but fails on gfortran, by having spaces where character should be displayed.

[mac27:~] bmcinnes% more p.f
      CHARACTER FOR*(*)
      PARAMETER(FOR='(T114,A3,  T1,A4,  T5,A2,  T7,A2,  T9,A4, T27,A1, T
     +18,A6, T13,A5, T28,A1,T119,A3,T122,A3,T125,A2,T109,A1,T127,A2,T129
     +,A1,T130,A1,T131,A1, T46,A1, T47,A3, T50,A1, T51,A3, T54,A1, T55,A
     +2, T57,A2, T59,A1,T183,A1, T60,A5, T69,A1, T70,A4, T75,A4, T80,A4,
     + T86,A4, T84,A2, T90,A1, T91,A1, T92,A1, T93,A1, T94,A1, T95,A1, T
     +96,A1, T97,A2, T99,A2,T101,A2,T103,A2,T105,A2,T107,A2, T44,A2,T134
     +,A2, T29,A1, T30,A1, T65,A1, T66,A3,T195,A1,T196,A2,T198,A1, T33,A
     +2, T35:A1, T36:A1, T37:A1, T38:A1, T39:A1, T40:A1, T41:A1, T42:A1,
     +T178,A1,T179,A1, T74,A1,T182,A1,T132,A1,T133,A1,T109,A1,T109,A1,T1
     +09,A1,T109,A1,T148,A1,T149,A1,T150,A1,T151,A1,T152,A1,T153,A1,T154
     +,A1,T109,A1,T109,A1,T109,A1,T109,A1,T109,A1,T109,A1,T109,A1,T109,A
     +1,T109,A1,T171,A1,T109,A1,T109,A1,T109,A1,T109,A1,T109,A1,T155,A1,
     +T156,A1,T157,A1,T158,A1,T159,A1,T160,A1,T161,A1,T162,A1,T163,A1,T1
     +64,A1,T165,A1,T166,A1,T167,A1,T168,A1,T109,A1)')
      character a(111)
      data a/111*'a'/
      write(6,for)a
      end
[mac27:~] bmcinnes% g95 p.f
[mac27:~] bmcinnes% ./a.out
   a a a   a    a     a   aaaa   aaaaaaaaa  aa  aa  aa a aa    aa  aa   aa   a    a a   aaaaaaaa a a a a a aa      a    a  a a aaaaaa a            aaaaaaaaaaaaaaaaaaaaa  a      aa  aa           a aa
[mac27:~] bmcinnes% gfortran p.f
ld: warning, duplicate dylib /usr/local/gfortran/lib/libgcc_s.1.dylib
[mac27:~] bmcinnes% ./a.out
   a a a   a    a     a   aaaa   aaaaaaaaa  aa  aa  aa a aa    aa  a     a                                  a                      aa              aaaaaaaaaaaaaaaaaaaaa
[mac27:~] bmcinnes% gfortran --version
GNU Fortran (GCC) 4.3.0 20071017 (experimental) [trunk revision 129405]
Copyright (C) 2007 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

[mac27:~] bmcinnes%
Comment 1 Tobias Burnus 2008-01-14 22:38:04 UTC
Jerry, do you have an idea?

Confirm. Reduced test case:

      character a(6)
      a = transfer("abcdef", a,size(a))
      write(*,'(T20,A3,  T1,A4,  T5,A2,  T7,A2,  T9,A4, T17,A1)') a
      end

Expected:
   b c d   e    f    a
Actual:
   b c d   e    f

Using "character(5)" works.

(Don't forget to test also the big test case; ifort for instance passes the test above, but writes non-printable characters (combined with "a" and " ") for column > 135 while g95, openg95/sunf95 and NAG f95 work.)
Comment 2 Thomas Koenig 2008-01-14 22:53:35 UTC
This is also a regression wrt g77:

$ cat foo.f 
      character a(6)
      data a / 'a', 'b', 'c', 'd', 'e', 'f' /
      write(*,'(T20,A3,  T1,A4,  T5,A2,  T7,A2,  T9,A4, T17,A1)') a
      end
$ g77 foo.f 
$ ./a.out
   b c d   e    f    a
Comment 3 Jerry DeLisle 2008-01-15 01:18:03 UTC
I think I better fix this if I can. :)
Comment 4 Jerry DeLisle 2008-01-17 06:42:12 UTC
Interestingly, we are getting a spurious FMT_COLON token which is causing a premature exit from the formatted transfer function and a miscalculation of the maximum position, resulting in a truncation of the output.
Comment 5 Jerry DeLisle 2008-01-18 14:25:51 UTC
Found it, Patch is on the way
Comment 6 Barry McInnes 2008-01-18 14:40:30 UTC
Subject: Re:  tab format failure to display properly
 (regression vs. g77)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks - how does one get and install the patch ?

On 1/18/08 7:25 AM, jvdelisle at gcc dot gnu dot org wrote:
| ------- Comment #5 from jvdelisle at gcc dot gnu dot org  2008-01-18
14:25 -------
| Found it, Patch is on the way
|
|

- --
- ---
Barry McInnes
325 Broadway
Boulder CO 80304
(303)4976231
barry.j.mcinnes@noaa.gov
- ---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFHkLpGKoTeRnsNi5kRAi+6AJ9hIWsh8WlyybETu1i6RPxB1LCKkwCfZyFf
tRJSc6IX9rqPWESUc5IyJSQ=
=4/F4
-----END PGP SIGNATURE-----
Comment 7 Tobias Burnus 2008-01-18 16:10:18 UTC
> Thanks - how does one get and install the patch ?

Well, that is difficult - he did not post it. It was probably neither in the final shape nor regression tested to make sure it does not break something of the test suite.

I think he will send the patch today (or tomorrow) to the mailing list, i.e. http://gcc.gnu.org/ml/fortran/2008-01/. Then you can either apply the patch and build GCC yourself or you wait a between 15min to 36h until it has been committed. If you don't build GCC yourself, add additionally up to 24h until the provided binaries contain the patch.
Comment 8 Barry McInnes 2008-01-18 19:29:32 UTC
Subject: Re:  tab format failure to display properly
 (regression vs. g77)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks again - I will wait the 36h, then I can try out the released
package ?

On 1/18/08 9:10 AM, burnus at gcc dot gnu dot org wrote:
| ------- Comment #7 from burnus at gcc dot gnu dot org  2008-01-18
16:10 -------
|> Thanks - how does one get and install the patch ?
|
| Well, that is difficult - he did not post it. It was probably neither
in the
| final shape nor regression tested to make sure it does not break
something of
| the test suite.
|
| I think he will send the patch today (or tomorrow) to the mailing
list, i.e.
| http://gcc.gnu.org/ml/fortran/2008-01/. Then you can either apply the
patch and
| build GCC yourself or you wait a between 15min to 36h until it has been
| committed. If you don't build GCC yourself, add additionally up to 24h
until
| the provided binaries contain the patch.
|
|

- --
- ---
Barry McInnes
325 Broadway
Boulder CO 80304
(303)4976231
barry.j.mcinnes@noaa.gov
- ---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFHkP38KoTeRnsNi5kRAvtJAJ4mYoouvqOGCZistqdrH7zYTzzDiACfYgti
80B/Jgo1/khokxKY4ZWyYNU=
=OTHx
-----END PGP SIGNATURE-----
Comment 9 Jerry DeLisle 2008-01-18 22:23:07 UTC
Subject: Bug 34782

Author: jvdelisle
Date: Fri Jan 18 22:22:21 2008
New Revision: 131641

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131641
Log:
2007-01-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR target/34782
	* gfortran.dg/fmt_t_6.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/fmt_t_6.f
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 10 Jerry DeLisle 2008-01-18 22:24:37 UTC
Fixed on trunk.