From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E32293858D28; Sun, 15 May 2022 08:59:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E32293858D28 From: "harper at msor dot vuw.ac.nz" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point' Date: Sun, 15 May 2022 08:59:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 9.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: harper at msor dot vuw.ac.nz X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 May 2022 08:59:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 --- Comment #8 from harper at msor dot vuw.ac.nz --- Thank you. Unfortunately I think you found some but not all of what the standard says about semicolons as separators. You will recall that my original bug report had a program compiled with std=3Df2003, which should disallow extensions to that standard. (I chose f2003 because that was the first version in which POINT and COMMA appeared.) I admit that the f2003 standard 10.9 begins as follows: List-directed input/output allows data editing according to the type of the list item instead of by a format specification. It also allows data to be free-field, that is, separated by commas (or semicolons) or blanks. That would allow a free choice between comma and semicolon, except that later in 10.9 a semicolon is allowed only if the decimal edit mode is COMMA. In my test program the decimal edit mode was POINT, not COMMA. The wording that may have been overlooked was this: A value separator is (1) A comma optionally preceded by one or more contiguous blanks and optionally followed by one or more contiguous blanks, unless the decimal edit mode is COMMA, in which case a semicolon is used in place of the comma, (2) ... Equivalent wording to f2003 10.9 is in f2018 13.10.1 and 13.10.2. On Sat, 14 May 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Sat, 14 May 2022 22:00:09 +0000 > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal=3D'point' > Resent-Date: Sun, 15 May 2022 10:00:21 +1200 (NZST) > Resent-From: >=20 > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 > > --- Comment #7 from Jerry DeLisle --- > My apologies for taking some time to get back to this. After a closer lo= ok, I > realize that in the original test case there is no problem. The semicolo= n is > an acceptable value separator regardless of decimal=3D'point' or decimal= =3D'comma' > > Take these two examples: > > 1) The comma is the decimal keeper so semicolon must be used as the separ= ator > > implicit none > integer n,m,ios > real r > character(20):: testinput =3D '1;17;3,14159' > n =3D 999 > print *,'testinput =3D "',testinput,'"' > read(testinput,*,decimal=3D'comma', iostat=3Dios) n, m, r > print *,'n=3D',n,' m=3D ', m,' r=3D ', r,' ios=3D',ios > if(ios>0) print *,'testinput was not an integer' > end program > > 2) The point is the decimal keeper so semicolon may be used as the separa= tor or > a comma > > implicit none > integer n,m,ios > real r > character(20):: testinput =3D '1;17;3.14159' > n =3D 999 > print *,'testinput =3D "',testinput,'"' > read(testinput,*,decimal=3D'point', iostat=3Dios) n, m, r > print *,'n=3D',n,' m=3D ', m,' r=3D ', r,' ios=3D',ios > if(ios>0) print *,'testinput was not an integer' > end program > > In the original test case, the semicolon is a separator and is simply end= ing > the read as no value is there. > > --=20 > You are receiving this mail because: > You reported the bug. > -- John Harper, School of Mathematics and Statistics Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand. e-mail john.harper@vuw.ac.nz phone +64(0) 4 463 5276=