public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/43217] New: Output of Hollerith constants which are not a multiple of 4 bytes Date: Mon, 01 Mar 2010 10:18:00 -0000 [thread overview] Message-ID: <bug-43217-13404@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2010-03-01 10:18 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-03-01 10:18 burnus at gcc dot gnu dot org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-43217-13404@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).