From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30687 invoked by alias); 21 Mar 2013 12:34:24 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 30657 invoked by uid 48); 21 Mar 2013 12:34:17 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/56675] New: I/O: Check edit descriptors with READ/WRITE used in FORMAT statements Date: Thu, 21 Mar 2013 12:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg01452.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56675 Bug #: 56675 Summary: I/O: Check edit descriptors with READ/WRITE used in FORMAT statements Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org https://groups.google.com/forum/#!topic/comp.lang.fortran/BxWaYSkmV2w The following code shows that the special checks for READ/WRITE/PRINT do not get checked for with FORMAT but only with a string. Seemingly, the format is checked when FORMAT is encountered - one should consider to do additionally a check if READ/WRITE/PRINT is used. [The latter becomes even more useful when looking at the types of the arguments (e.g. "a" edit descriptor with a "real" expression/variable). However, currently this is only checked at run time. For compile time, it should be doable if the I/O list doesn't contain nonconst-shape arrays and no io-do-lists.] implicit none integer :: z ! OK: Diagnosed. (Side note: Also diagnosed by NAG.) ! character(len=*), parameter :: str = '(i0)' ! read (*,str) z ! Positive width required in format string ! read (*,"(i0)") z ! "Positive width required in format string" ! Not diagnosed but diagnosable. (Also not diagnosed by NAG.) read (*, 99) z ! 'Wrongly' accepted (at compile time) 99 FORMAT (i0) ! (gives error at run time) ! RFC: Validly rejected or not? (Note: Also rejected by NAG) ! read (*, 100) z ! Rejected at run time (but not used; ! 100 FORMAT (i2,i0)! may it reject it or not?) end