From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8C802385736A; Thu, 19 May 2022 00:10:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C802385736A 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: Thu, 19 May 2022 00:10:44 +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: Thu, 19 May 2022 00:10:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 --- Comment #19 from harper at msor dot vuw.ac.nz --- Thank you. To make the outputs from my test program testdecimal.f90 easier= =20 to compare when using different compilers, and to clarify where a reading=20 error happened, I have revised the program to make its results clearer. Below is the new version of the program. I see no point in sending its output with my gfortran, which does not have Jerry's latest corrections, but I do provide its output with ifort, which it is not your job to debug! john@johns-laptop:~/Jfh$ cat testdecimal.f90 ! Test list-directed reading with decimal=3D'point' and 'comma' by ! printing one line for each of 32 cases, reading input(1:16) with each ! of 'point' or 'comma', using s(ios) to give ERR, OK or end according ! to the iostat=3Dios value from reading. Before reading, x=3D[666,999]. implicit none real x(2) integer ios,i,j character(*),parameter:: punc=3D",; .",fmt=3D'(1X,A,I2,1X,5A,2F7.1,1X,A)' integer,parameter:: lpunc =3Dlen(punc) character:: dec(2)*5=3D['point','comma'], 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) do j =3D 1,2 x =3D [666, 999] read(input(i),*,decimal=3Ddec(j),iostat=3Dios) x print fmt,'i=3D',i,' input=3D"',input(i),'" with ',dec(j),& ' x =3D',x,s(ios) end do end do contains character(3) function s(ios) ! ERR, OK ,end if ios>0, =3D=3D0, <0 integer,intent(in):: ios s =3D merge('ERR',merge(' OK','end',ios=3D=3D0),ios>0) end function s end program john@johns-laptop:~/Jfh$ ifort testdecimal.f90; ./a.out Compiling "ifort testdecimal.f90" i=3D 1 input=3D"2,5," with point x =3D 2.0 5.0 OK i=3D 1 input=3D"2,5," with comma x =3D 666.0 999.0 ERR i=3D 2 input=3D"2;5," with point x =3D 666.0 999.0 ERR i=3D 2 input=3D"2;5," with comma x =3D 2.0 5.0 OK i=3D 3 input=3D"2 5," with point x =3D 2.0 5.0 OK i=3D 3 input=3D"2 5," with comma x =3D 2.0 5.0 OK i=3D 4 input=3D"2.5," with point x =3D 2.5 999.0 end i=3D 4 input=3D"2.5," with comma x =3D 666.0 999.0 ERR i=3D 5 input=3D"2,5;" with point x =3D 2.0 999.0 ERR i=3D 5 input=3D"2,5;" with comma x =3D 2.5 999.0 end i=3D 6 input=3D"2;5;" with point x =3D 666.0 999.0 ERR i=3D 6 input=3D"2;5;" with comma x =3D 2.0 5.0 OK i=3D 7 input=3D"2 5;" with point x =3D 2.0 999.0 ERR i=3D 7 input=3D"2 5;" with comma x =3D 2.0 5.0 OK i=3D 8 input=3D"2.5;" with point x =3D 666.0 999.0 ERR i=3D 8 input=3D"2.5;" with comma x =3D 666.0 999.0 ERR i=3D 9 input=3D"2,5 " with point x =3D 2.0 5.0 OK i=3D 9 input=3D"2,5 " with comma x =3D 2.5 999.0 end i=3D10 input=3D"2;5 " with point x =3D 666.0 999.0 ERR i=3D10 input=3D"2;5 " with comma x =3D 2.0 5.0 OK i=3D11 input=3D"2 5 " with point x =3D 2.0 5.0 OK i=3D11 input=3D"2 5 " with comma x =3D 2.0 5.0 OK i=3D12 input=3D"2.5 " with point x =3D 2.5 999.0 end i=3D12 input=3D"2.5 " with comma x =3D 666.0 999.0 ERR i=3D13 input=3D"2,5." with point x =3D 2.0 5.0 OK i=3D13 input=3D"2,5." with comma x =3D 666.0 999.0 ERR i=3D14 input=3D"2;5." with point x =3D 666.0 999.0 ERR i=3D14 input=3D"2;5." with comma x =3D 2.0 999.0 ERR i=3D15 input=3D"2 5." with point x =3D 2.0 5.0 OK i=3D15 input=3D"2 5." with comma x =3D 2.0 999.0 ERR i=3D16 input=3D"2.5." with point x =3D 666.0 999.0 ERR i=3D16 input=3D"2.5." with comma x =3D 666.0 999.0 ERR john@johns-laptop:~/Jfh$ On Wed, 18 May 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Wed, 18 May 2022 02:52:26 +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: Wed, 18 May 2022 14:52:38 +1200 (NZST) > Resent-From: >=20 > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105473 > > --- Comment #18 from Jerry DeLisle --- > (In reply to harper from comment #17) >> On comparing that with ifort's result I think that the only remaining bug >> is that if decimal=3D'comma' then '.' is neither a decimal symbol nor a >> separator (see f2018 13.6). > > Making this easier for others to see. > > With gfortran I see with the 8th sub-case: > > i=3D 8 input(i) =3D "2.5;" > with decimal=3Dpoint x(:) =3D2.5 666.0 ios=3D5010 > with decimal=3Dcomma x(:) =3D2.5 666.0 ios=3D-1 > > i=3D 12 input(i) =3D "2.5 " > with decimal=3Dpoint x(:) =3D2.5 666.0 ios=3D-1 > with decimal=3Dcomma x(:) =3D2.5 666.0 ios=3D-1 > > In these cases the decimal=3Dcomma should have never seen 2.5 > > With ifort: > > 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 don't think ifort has the decimal=3Dpoint part right, as if it backed u= p and > read the digit 5 a second time. > > Regardless, getting closer here. I will work on the gfortran comma issue. > > --=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=