From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E81D3858D3C; Mon, 16 May 2022 04:12:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E81D3858D3C 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: Mon, 16 May 2022 04:12:35 +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: Mon, 16 May 2022 04:12:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 --- Comment #16 from harper at msor dot vuw.ac.nz --- I have now used ifort on my latest test program, which you should=20 already have, in the hope that it helps you. It printed this: john@johns-laptop:~/Jfh$ ifort testiostat4.f90 Compiling "ifort testiostat4.f90" john@johns-laptop:~/Jfh$ ./a.out i=3D 1 input(i) =3D "2,5," with decimal=3Dpoint x(:) =3D 2.0 5.0 ios=3D0 with decimal=3Dcomma x(:) =3D 666.0 666.0 ios=3D59 i=3D 2 input(i) =3D "2;5," with decimal=3Dpoint x(:) =3D 666.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 2.0 5.0 ios=3D0 i=3D 3 input(i) =3D "2 5," with decimal=3Dpoint x(:) =3D 2.0 5.0 ios=3D0 with decimal=3Dcomma x(:) =3D 2.0 5.0 ios=3D0 i=3D 4 input(i) =3D "2.5," with decimal=3Dpoint x(:) =3D 2.5 666.0 ios=3D-1 with decimal=3Dcomma x(:) =3D 666.0 666.0 ios=3D59 i=3D 5 input(i) =3D "2,5;" with decimal=3Dpoint x(:) =3D 2.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 2.5 666.0 ios=3D-1 i=3D 6 input(i) =3D "2;5;" with decimal=3Dpoint x(:) =3D 666.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 2.0 5.0 ios=3D0 i=3D 7 input(i) =3D "2 5;" with decimal=3Dpoint x(:) =3D 2.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 2.0 5.0 ios=3D0 i=3D 8 input(i) =3D "2.5;" with decimal=3Dpoint x(:) =3D 666.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 666.0 666.0 ios=3D59 i=3D 9 input(i) =3D "2,5 " with decimal=3Dpoint x(:) =3D 2.0 5.0 ios=3D0 with decimal=3Dcomma x(:) =3D 2.5 666.0 ios=3D-1 i=3D 10 input(i) =3D "2;5 " with decimal=3Dpoint x(:) =3D 666.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 2.0 5.0 ios=3D0 i=3D 11 input(i) =3D "2 5 " with decimal=3Dpoint x(:) =3D 2.0 5.0 ios=3D0 with decimal=3Dcomma x(:) =3D 2.0 5.0 ios=3D0 i=3D 12 input(i) =3D "2.5 " with decimal=3Dpoint x(:) =3D 2.5 666.0 ios=3D-1 with decimal=3Dcomma x(:) =3D 666.0 666.0 ios=3D59 i=3D 13 input(i) =3D "2,5." with decimal=3Dpoint x(:) =3D 2.0 5.0 ios=3D0 with decimal=3Dcomma x(:) =3D 666.0 666.0 ios=3D59 i=3D 14 input(i) =3D "2;5." with decimal=3Dpoint x(:) =3D 666.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 2.0 666.0 ios=3D59 i=3D 15 input(i) =3D "2 5." with decimal=3Dpoint x(:) =3D 2.0 5.0 ios=3D0 with decimal=3Dcomma x(:) =3D 2.0 666.0 ios=3D59 i=3D 16 input(i) =3D "2.5." with decimal=3Dpoint x(:) =3D 666.0 666.0 ios=3D59 with decimal=3Dcomma x(:) =3D 666.0 666.0 ios=3D59 john@johns-laptop:~/Jfh$ -- 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 ---------- Forwarded message ---------- Date: Mon, 16 May 2022 01:44:15 +0000 From: harper at msor dot vuw.ac.nz To: John Harper Subject: [Bug fortran/105473] semicolon allowed when list-directed read int= eger with decimal=3D'point' Resent-Date: Mon, 16 May 2022 13:44:25 +1200 (NZST) Resent-From: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 --- Comment #15 from harper at msor dot vuw.ac.nz --- Thank you. My test program failed to distinguish some bad cases from good cases; a revised version of the program is below. The important change was making both elements of x be 666 just before both read statements, to allow checking whether anything was read as well as what. A cosmetic change was an explicit format called fmt instead of * when printing x etc. ! Does list-directed reading work properly with decimal=3D'comma' ? implicit none real x(2) character(*),parameter:: punc =3D ",; .", fmt =3D '(A,2(F0.1,1X),A,I0)' integer,parameter:: lpunc =3Dlen(punc) integer ios,i,j character:: msg*80, input(lpunc**2)*4 =3D & [(("2"//punc(i:i)//"5"//punc(j:j),i=3D1,lpunc),j=3D1,lpunc)] do i =3D 1,size(input) print *,'i=3D',i,'input(i) =3D "',input(i),'"' x =3D 666 read(input(i),*,decimal=3D'point',iostat=3Dios,iomsg=3Dmsg) x print fmt,' with decimal=3Dpoint x(:) =3D',x,' ios=3D',ios ! if(ios/=3D0) print *,trim(msg) x =3D 666 read(input(i),*,decimal=3D'comma',iostat=3Dios,iomsg=3Dmsg) x print fmt,' with decimal=3Dcomma x(:) =3D',x,' ios=3D',ios ! if(ios/=3D0) print *,trim(msg) end do end program On Mon, 16 May 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Mon, 16 May 2022 00:49:44 +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: Mon, 16 May 2022 12:49:53 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 > > --- Comment #13 from Jerry DeLisle --- > With John's multiple combinations test case I get the following results w= ith > the attached patch. All places where we gave an error before the patch, w= e give > errors now plus new errors > > $ gfc multi.f90 > $ ./a.out > i=3D 1 input(i) =3D "2,5," > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > i=3D 2 input(i) =3D "2;5," > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 3 input(i) =3D "2 5," > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 4 input(i) =3D "2.5," > with decimal=3Dpoint x(:) =3D 2.50000000 5.00000000 ios=3D = -1 > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = 5010 > i=3D 5 input(i) =3D "2,5;" > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > i=3D 6 input(i) =3D "2;5;" > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 7 input(i) =3D "2 5;" > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 8 input(i) =3D "2.5;" > with decimal=3Dpoint x(:) =3D 2.50000000 5.00000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > i=3D 9 input(i) =3D "2,5 " > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > i=3D 10 input(i) =3D "2;5 " > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 11 input(i) =3D "2 5 " > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 12 input(i) =3D "2.5 " > with decimal=3Dpoint x(:) =3D 2.50000000 5.00000000 ios=3D = -1 > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > i=3D 13 input(i) =3D "2,5." > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > i=3D 14 input(i) =3D "2;5." > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 15 input(i) =3D "2 5." > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 16 input(i) =3D "2.5." > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 5010 > with decimal=3Dcomma x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > [jerry@amdr pr105473]$ gfc multi.f90 > [jerry@amdr pr105473]$ ./a.out > i=3D 1 input(i) =3D "2,5," > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Bad real number in item 1 of list input > i=3D 2 input(i) =3D "2;5," > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 3 input(i) =3D "2 5," > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 4 input(i) =3D "2.5," > with decimal=3Dpoint x(:) =3D 2.50000000 5.00000000 ios=3D = -1 > End of file > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = 5010 > Bad real number in item 1 of list input > i=3D 5 input(i) =3D "2,5;" > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > End of file > i=3D 6 input(i) =3D "2;5;" > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 7 input(i) =3D "2 5;" > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 8 input(i) =3D "2.5;" > with decimal=3Dpoint x(:) =3D 2.50000000 5.00000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > End of file > i=3D 9 input(i) =3D "2,5 " > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > End of file > i=3D 10 input(i) =3D "2;5 " > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 11 input(i) =3D "2 5 " > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 12 input(i) =3D "2.5 " > with decimal=3Dpoint x(:) =3D 2.50000000 5.00000000 ios=3D = -1 > End of file > with decimal=3Dcomma x(:) =3D 2.50000000 666.000000 ios=3D = -1 > End of file > i=3D 13 input(i) =3D "2,5." > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Bad real number in item 1 of list input > i=3D 14 input(i) =3D "2;5." > with decimal=3Dpoint x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Semicolon not allowed as separator with DECIMAL=3D'point' > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 15 input(i) =3D "2 5." > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > with decimal=3Dcomma x(:) =3D 2.00000000 5.00000000 ios=3D = 0 > i=3D 16 input(i) =3D "2.5." > with decimal=3Dpoint x(:) =3D 2.00000000 5.00000000 ios=3D = 5010 > Bad real number in item 1 of list input > with decimal=3Dcomma x(:) =3D 2.00000000 666.000000 ios=3D = 5010 > Bad real number in item 1 of list input > > -- > 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=