public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43217]  New: Output of Hollerith constants which are not a multiple of 4 bytes
@ 2010-03-01 10:18 burnus at gcc dot gnu dot org
  2010-03-01 10:30 ` [Bug fortran/43217] " dominiq at lps dot ens dot fr
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-03-01 10:18 UTC (permalink / raw)
  To: gcc-bugs

I do not know whether the following program is valid Fortran 77 (with deleted
parts). The issue is that gfortran creates:

    static character(kind=1) C.1534[1:9] = "HELLO YOU";

which is then passed to an default-kind integer. "HELLO YOU" consists of 9
characters, but a default-kind integer can accommodate for multiples of 4, i.e.
12 characters. Thus, printing with "FORMAT (100A4)" prints more data than
available.

gfortran:
HELLO YOUhfj
:HELLO YOUhfj:
4C4C4548 4F59204F 6A666855
where "od" shows that it prints:
  H   E   L   L   O  sp   Y   O   U   h   f   j  nl

ifort:
HELLO YOU
:HELLO YOU:
4C4C4548 4F59204F       55
   H   E   L   L   O  sp   Y   O   U nul nul nul  nl
i.e. it prints trailing NULs.

NAG f95:
HELLO YOU
:HELLO YOU:
4C4C4548 4F59204F 34280055
   H   E   L   L   O  sp   Y   O   U nul   (   4  nl

sunf95:
HELLO YOU
:HELLO YOU:
4C4C4548 4F59204F       55
  H   E   L   L   O  sp   Y   O   U nul nul nul  nl

open64:
HELLO YOU
:HELLO YOU   :
4C4C4548 4F59204F 20202055
   H   E   L   L   O  sp   Y   O   U  sp  sp  sp  nl

pathscale:
HELLO YOU
:HELLO YOU   :
4C4C4548 4F59204F 20202055
   H   E   L   L   O  sp   Y   O   U  sp  sp  sp  nl

Thus either by zero or by space padding it seems to work in the other
compilers. I wonder what happens with g77.


The program itself:

C     PROGRAM HELLO2
      CALL WRTOUT (9HHELLO YOU, 9)
      STOP
      END
C
      SUBROUTINE WRTOUT (IARRAY, NCHRS)
C
      INTEGER IARRAY(1)
      INTEGER NCHRS
C
      INTEGER ICPW
      DATA ICPW/4/
      INTEGER I, NWRDS
C
      NWRDS = (NCHRS + ICPW - 1) /ICPW
      WRITE (6,100) (IARRAY(I), I=1,NWRDS)
      WRITE (6,101) (IARRAY(I), I=1,NWRDS)
      write(*,'(4(z8," "))') (IARRAY(I), I=1,NWRDS)
      RETURN
  100 FORMAT (100A4)
  101 FORMAT (':',3A4,':')
      END


-- 
           Summary: Output of Hollerith constants which are not a multiple
                    of 4 bytes
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43217


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-08-27 15:02 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01 10:18 [Bug fortran/43217] New: Output of Hollerith constants which are not a multiple of 4 bytes burnus at gcc dot gnu dot org
2010-03-01 10:30 ` [Bug fortran/43217] " dominiq at lps dot ens dot fr
2010-03-01 14:31 ` jvdelisle at gcc dot gnu dot org
2010-03-01 15:38 ` burnus at gcc dot gnu dot org
2010-03-02  9:50 ` burnus at gcc dot gnu dot org
2010-03-04  3:08 ` jvdelisle at gcc dot gnu dot org
2010-03-04  3:15 ` kargl at gcc dot gnu dot org
2010-08-21 16:42 ` jvdelisle at gcc dot gnu dot org
2010-08-27  6:50 ` jvdelisle at gcc dot gnu dot org
2010-08-27  7:26 ` burnus at gcc dot gnu dot org
2010-08-27 10:23 ` dominiq at lps dot ens dot fr
2010-08-27 14:02 ` jvdelisle at gcc dot gnu dot org
2010-08-27 14:20 ` dominiq at lps dot ens dot fr
2010-08-27 14:48 ` dominiq at lps dot ens dot fr
2010-08-27 15:00 ` jvdelisle at gcc dot gnu dot org
2010-08-27 15:02 ` jvdelisle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).