[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 Jerry DeLisle changed: What|Removed |Added CC||jvdelisle2 at gmail dot com --- Comment #1 from Jerry DeLisle --- Well, looks like we are allowing as an extension. $ gfortran -std=f95 pr105473.f90 pr105473.f90:6:27: 6 | read(testinput,*,decimal='point',iostat=ios) n | 1 Error: Fortran 2003: DECIMAL= at (1) not allowed in Fortran 95 If you set n to some value so that it is 'defined' per the standards like this: ! Does list-directed reading an integer allow some non-integer input? implicit none integer n,ios character(1):: testinput = ';' n = 999 print *,'testinput = "',testinput,'"' read(testinput,*,decimal='point',iostat=ios) n print *,'n=',n,' ios=',ios if(ios>0) print *,'testinput was not an integer' end program $ gfortran pr105473.f90 [jerry@amdr pr105473]$ ./a.out testinput = ";" n= 999 ios= 0 You will see that nothing is read into n at all. The list read is just ended.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #2 from Jerry DeLisle --- I should add, I am not saying this is right or wrong. The error message refers to F2003. $ gfortran -std=f2003 pr105473.f90 [jerry@amdr pr105473]$ ./a.out testinput = ";" n= 999 ios= 0 It is being allowed with the later standard flag. We will have to dig through the standard as well as look at the error checking that is in place to answer the question.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #3 from harper at msor dot vuw.ac.nz --- Thank you. Of course the program did not compile with -std=f95 because there was no decimal='point' option then. But with -std=f2003 or f2008 or f2018, and with or without n = 999 before the read statement, ios was always 0 after it. I had thought that extensions to the relevant standard were supposed to be disallowed when one compiled with a std= version. Ifort gave a positive value of ios, which the f2003, f2008 and f2018 standards all require for that program. On Thu, 5 May 2022, jvdelisle2 at gmail dot com wrote: > Date: Thu, 5 May 2022 02:14:42 + > From: jvdelisle2 at gmail dot com > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Thu, 5 May 2022 14:14:52 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > Jerry DeLisle changed: > > What|Removed |Added > > CC||jvdelisle2 at gmail dot com > > --- Comment #1 from Jerry DeLisle --- > Well, looks like we are allowing as an extension. > > $ gfortran -std=f95 pr105473.f90 > pr105473.f90:6:27: > >6 | read(testinput,*,decimal='point',iostat=ios) n > | 1 > Error: Fortran 2003: DECIMAL= at (1) not allowed in Fortran 95 > > If you set n to some value so that it is 'defined' per the standards like > this: > > ! Does list-directed reading an integer allow some non-integer input? > implicit none > integer n,ios > character(1):: testinput = ';' > n = 999 > print *,'testinput = "',testinput,'"' > read(testinput,*,decimal='point',iostat=ios) n > print *,'n=',n,' ios=',ios > if(ios>0) print *,'testinput was not an integer' > end program > > $ gfortran pr105473.f90 > [jerry@amdr pr105473]$ ./a.out > testinput = ";" > n= 999 ios= 0 > > You will see that nothing is read into n at all. The list read is just ended. > > -- > 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.har...@vuw.ac.nz phone +64(0) 4 463 5276
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #4 from Jerry DeLisle --- Hi all, I will be looking closer on this one. As I said have to look at the checking code. As soon as I noticed -std=f2003 allowing this it makes no sense at all. I can understand possibly the extension to allow a semicolon to simply end the transfer. We do need to fix the diagnostics. I see I no longer have change status on PRs. Evidently some of the address and login changes I have had to do in the process of changing my email providers has messed it all up. Who do you call? Ghost Busters?
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #5 from anlauf at gcc dot gnu.org --- (In reply to Jerry DeLisle from comment #4) > I see I no longer have change status on PRs. Evidently some of the address > and login changes I have had to do in the process of changing my email > providers has messed it all up. Jerry, have you tried to log in using your @gcc.gnu.org address?
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 Jerry DeLisle changed: What|Removed |Added Last reconfirmed||2022-05-08 Assignee|unassigned at gcc dot gnu.org |jvdelisle at gcc dot gnu.org Ever confirmed|0 |1 CC||jvdelisle at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #6 from Jerry DeLisle --- I will take this one. My gcc.gnu.org account evaporated. All I had to do is re-create it.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #7 from Jerry DeLisle --- My apologies for taking some time to get back to this. After a closer look, I realize that in the original test case there is no problem. The semicolon is an acceptable value separator regardless of decimal='point' or decimal='comma' Take these two examples: 1) The comma is the decimal keeper so semicolon must be used as the separator implicit none integer n,m,ios real r character(20):: testinput = '1;17;3,14159' n = 999 print *,'testinput = "',testinput,'"' read(testinput,*,decimal='comma', iostat=ios) n, m, r print *,'n=',n,' m= ', m,' r= ', r,' ios=',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 separator or a comma implicit none integer n,m,ios real r character(20):: testinput = '1;17;3.14159' n = 999 print *,'testinput = "',testinput,'"' read(testinput,*,decimal='point', iostat=ios) n, m, r print *,'n=',n,' m= ', m,' r= ', r,' ios=',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 ending the read as no value is there.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- 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=f2003, 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 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Sun, 15 May 2022 10:00:21 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #7 from Jerry DeLisle --- > My apologies for taking some time to get back to this. After a closer look, I > realize that in the original test case there is no problem. The semicolon is > an acceptable value separator regardless of decimal='point' or decimal='comma' > > Take these two examples: > > 1) The comma is the decimal keeper so semicolon must be used as the separator > > implicit none > integer n,m,ios > real r > character(20):: testinput = '1;17;3,14159' > n = 999 > print *,'testinput = "',testinput,'"' > read(testinput,*,decimal='comma', iostat=ios) n, m, r > print *,'n=',n,' m= ', m,' r= ', r,' ios=',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 separator > or > a comma > > implicit none > integer n,m,ios > real r > character(20):: testinput = '1;17;3.14159' > n = 999 > print *,'testinput = "',testinput,'"' > read(testinput,*,decimal='point', iostat=ios) n, m, r > print *,'n=',n,' m= ', m,' r= ', r,' ios=',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 ending > the read as no value is there. > > -- > 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.har...@vuw.ac.nz phone +64(0) 4 463 5276
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #9 from Jerry DeLisle --- Thank you for digging out the standards references. That was going to be my next step as the standards are notorious for these kinds of tidbits and corner cases. I have been reviewing the code implementations of this stuff so I have identified the places where checks can be added. Some of my preliminary attempts have resulted in quite a few test regressions. I am still at it here.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #10 from Jerry DeLisle --- Just completed good regression testing and have this: testinput = "1;17;3.14159" At line 8 of file pr105473.f90 Fortran runtime error: Semicolon not allowed as separator with DECIMAL='point' Now I wonder if I should likewise do the same for the other case with DECIMAL='comma' and we find a 'comma' separator.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #11 from harper at msor dot vuw.ac.nz --- Thank you Jerry. Commas as separators with DECIMAL = 'comma' may be trickier because commas then do the job that decimal points normally do, and they cannot act as separators. Here is a little test program that reads from all 16 of "2p5q" where p and q are comma,semicolon,blank, or point, using both 'comma' and 'point'. It gave me the same 60 lines of output with -std=f2003 or -std=f2018 ! Does list-directed reading work properly with decimal='comma' ? implicit none real x(2) character(*),parameter:: punc = ",; ." integer,parameter:: lpunc =len(punc) integer ios,i,j character:: msg*80, input(lpunc**2)*4 = & [(("2"//punc(i:i)//"5"//punc(j:j),i=1,lpunc),j=1,lpunc)] do i = 1,size(input) print *,'i=',i,'input(i) = "',input(i),'"' read(input(i),*,decimal='point',iostat=ios,iomsg=msg) x print *,'with decimal=point x(:) =',x,' ios=',ios if(ios/=0) print *,trim(msg) x(2) = 666 read(input(i),*,decimal='comma',iostat=ios,iomsg=msg) x print *,'with decimal=comma x(:) =',x,' ios=',ios if(ios/=0) print *,trim(msg) end do end program On Sun, 15 May 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Sun, 15 May 2022 15:56:00 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Mon, 16 May 2022 03:56:12 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #10 from Jerry DeLisle --- > Just completed good regression testing and have this: > > testinput = "1;17;3.14159" > At line 8 of file pr105473.f90 > Fortran runtime error: Semicolon not allowed as separator with DECIMAL='point' > > Now I wonder if I should likewise do the same for the other case with > DECIMAL='comma' and we find a 'comma' separator. > > -- > 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.har...@vuw.ac.nz phone +64(0) 4 463 5276
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #12 from Jerry DeLisle --- Created attachment 52981 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52981&action=edit Prposed Patch to add checks for 'comma' and 'point' This patch is pretty close. It does regression test OK.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #13 from Jerry DeLisle --- With John's multiple combinations test case I get the following results with the attached patch. All places where we gave an error before the patch, we give errors now plus new errors $ gfc multi.f90 $ ./a.out i= 1 input(i) = "2,5," with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 666.00 ios=5010 i= 2 input(i) = "2;5," with decimal=point x(:) = 2. 666.00 ios=5010 with decimal=comma x(:) = 2. 5. ios= 0 i= 3 input(i) = "2 5," with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 5. ios= 0 i= 4 input(i) = "2.5," with decimal=point x(:) = 2.5000 5. ios= -1 with decimal=comma x(:) = 2.5000 666.00 ios=5010 i= 5 input(i) = "2,5;" with decimal=point x(:) = 2. 5. ios=5010 with decimal=comma x(:) = 2.5000 666.00 ios= -1 i= 6 input(i) = "2;5;" with decimal=point x(:) = 2. 666.00 ios=5010 with decimal=comma x(:) = 2. 5. ios= 0 i= 7 input(i) = "2 5;" with decimal=point x(:) = 2. 5. ios=5010 with decimal=comma x(:) = 2. 5. ios= 0 i= 8 input(i) = "2.5;" with decimal=point x(:) = 2.5000 5. ios=5010 with decimal=comma x(:) = 2.5000 666.00 ios= -1 i= 9 input(i) = "2,5 " with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2.5000 666.00 ios= -1 i= 10 input(i) = "2;5 " with decimal=point x(:) = 2. 666.00 ios=5010 with decimal=comma x(:) = 2. 5. ios= 0 i= 11 input(i) = "2 5 " with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 5. ios= 0 i= 12 input(i) = "2.5 " with decimal=point x(:) = 2.5000 5. ios= -1 with decimal=comma x(:) = 2.5000 666.00 ios= -1 i= 13 input(i) = "2,5." with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 666.00 ios=5010 i= 14 input(i) = "2;5." with decimal=point x(:) = 2. 666.00 ios=5010 with decimal=comma x(:) = 2. 5. ios= 0 i= 15 input(i) = "2 5." with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 5. ios= 0 i= 16 input(i) = "2.5." with decimal=point x(:) = 2. 5. ios=5010 with decimal=comma x(:) = 2. 666.00 ios=5010 [jerry@amdr pr105473]$ gfc multi.f90 [jerry@amdr pr105473]$ ./a.out i= 1 input(i) = "2,5," with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 666.00 ios=5010 Bad real number in item 1 of list input i= 2 input(i) = "2;5," with decimal=point x(:) = 2. 666.00 ios=5010 Semicolon not allowed as separator with DECIMAL='point' with decimal=comma x(:) = 2. 5. ios= 0 i= 3 input(i) = "2 5," with decimal=point x(:) = 2. 5. ios= 0 with decimal=comma x(:) = 2. 5. ios= 0 i= 4 input(i) = "2.5," with decimal=point x(:) = 2.5000 5. ios= -1 End of file with decimal=comma x(:) = 2.5000 666.00 ios=5010 Bad real number in item 1 of list input i= 5 input(i) = "2,5;" with decimal=point x(:) = 2. 5. ios=5010 Semicolon not allowed as separator with DECIMAL='point' with decimal=comma x(:) = 2.5000 666.00 ios= -1 End of file i= 6 input(i) = "2;5;" with decimal=point x(:) = 2. 666.00 ios=5010 Semicolon not allowed as separator with DECIMAL='point' with decimal=comma x(:) = 2. 5. ios= 0 i= 7 input(i) = "2 5;" with decimal=point x(:) = 2. 5. ios=5010 Semico
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #14 from Jerry DeLisle --- The first set of results in in Comment #13 is with the line that prints msg commented out. The second set is with the msg prints.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- 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='comma' ? implicit none real x(2) character(*),parameter:: punc = ",; .", fmt = '(A,2(F0.1,1X),A,I0)' integer,parameter:: lpunc =len(punc) integer ios,i,j character:: msg*80, input(lpunc**2)*4 = & [(("2"//punc(i:i)//"5"//punc(j:j),i=1,lpunc),j=1,lpunc)] do i = 1,size(input) print *,'i=',i,'input(i) = "',input(i),'"' x = 666 read(input(i),*,decimal='point',iostat=ios,iomsg=msg) x print fmt,' with decimal=point x(:) =',x,' ios=',ios ! if(ios/=0) print *,trim(msg) x = 666 read(input(i),*,decimal='comma',iostat=ios,iomsg=msg) x print fmt,' with decimal=comma x(:) =',x,' ios=',ios ! if(ios/=0) 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 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Mon, 16 May 2022 12:49:53 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #13 from Jerry DeLisle --- > With John's multiple combinations test case I get the following results with > the attached patch. All places where we gave an error before the patch, we > give > errors now plus new errors > > $ gfc multi.f90 > $ ./a.out > i= 1 input(i) = "2,5," > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 666.00 ios=5010 > i= 2 input(i) = "2;5," > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 3 input(i) = "2 5," > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 4 input(i) = "2.5," > with decimal=point x(:) = 2.5000 5. ios= -1 > with decimal=comma x(:) = 2.5000 666.00 ios=5010 > i= 5 input(i) = "2,5;" > with decimal=point x(:) = 2. 5. ios=5010 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 6 input(i) = "2;5;" > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 7 input(i) = "2 5;" > with decimal=point x(:) = 2. 5. ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 8 input(i) = "2.5;" > with decimal=point x(:) = 2.5000 5. ios=5010 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 9 input(i) = "2,5 " > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 10 input(i) = "2;5 " > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 11 input(i) = "2 5 " > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 12 input(i) = "2.5 " > with decimal=point x(:) = 2.5000 5. ios= -1 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 13 input(i) = "2,5." > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 666.00 ios=5010 > i= 14 input(i) = "2;5." > with decimal=point x(:
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #16 from harper at msor dot vuw.ac.nz --- I have now used ifort on my latest test program, which you should 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= 1 input(i) = "2,5," with decimal=point x(:) = 2.0 5.0 ios=0 with decimal=comma x(:) = 666.0 666.0 ios=59 i= 2 input(i) = "2;5," with decimal=point x(:) = 666.0 666.0 ios=59 with decimal=comma x(:) = 2.0 5.0 ios=0 i= 3 input(i) = "2 5," with decimal=point x(:) = 2.0 5.0 ios=0 with decimal=comma x(:) = 2.0 5.0 ios=0 i= 4 input(i) = "2.5," with decimal=point x(:) = 2.5 666.0 ios=-1 with decimal=comma x(:) = 666.0 666.0 ios=59 i= 5 input(i) = "2,5;" with decimal=point x(:) = 2.0 666.0 ios=59 with decimal=comma x(:) = 2.5 666.0 ios=-1 i= 6 input(i) = "2;5;" with decimal=point x(:) = 666.0 666.0 ios=59 with decimal=comma x(:) = 2.0 5.0 ios=0 i= 7 input(i) = "2 5;" with decimal=point x(:) = 2.0 666.0 ios=59 with decimal=comma x(:) = 2.0 5.0 ios=0 i= 8 input(i) = "2.5;" with decimal=point x(:) = 666.0 666.0 ios=59 with decimal=comma x(:) = 666.0 666.0 ios=59 i= 9 input(i) = "2,5 " with decimal=point x(:) = 2.0 5.0 ios=0 with decimal=comma x(:) = 2.5 666.0 ios=-1 i= 10 input(i) = "2;5 " with decimal=point x(:) = 666.0 666.0 ios=59 with decimal=comma x(:) = 2.0 5.0 ios=0 i= 11 input(i) = "2 5 " with decimal=point x(:) = 2.0 5.0 ios=0 with decimal=comma x(:) = 2.0 5.0 ios=0 i= 12 input(i) = "2.5 " with decimal=point x(:) = 2.5 666.0 ios=-1 with decimal=comma x(:) = 666.0 666.0 ios=59 i= 13 input(i) = "2,5." with decimal=point x(:) = 2.0 5.0 ios=0 with decimal=comma x(:) = 666.0 666.0 ios=59 i= 14 input(i) = "2;5." with decimal=point x(:) = 666.0 666.0 ios=59 with decimal=comma x(:) = 2.0 666.0 ios=59 i= 15 input(i) = "2 5." with decimal=point x(:) = 2.0 5.0 ios=0 with decimal=comma x(:) = 2.0 666.0 ios=59 i= 16 input(i) = "2.5." with decimal=point x(:) = 666.0 666.0 ios=59 with decimal=comma x(:) = 666.0 666.0 ios=59 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.har...@vuw.ac.nz phone +64(0) 4 463 5276 ------ Forwarded message ------ Date: Mon, 16 May 2022 01:44:15 + From: harper at msor dot vuw.ac.nz To: John Harper Subject: [Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point' Resent-Date: Mon, 16 May 2022 13:44:25 +1200 (NZST) Resent-From: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- 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='comma' ? implicit none real x(2) character(*),parameter:: punc = ",; .", fmt = '(A,2(F0.1,1X),A,I0)' integer,parameter:: lpunc =len(punc) integer ios,i,j character:: msg*80, input(lpunc**2)*4 = & [(("2"//punc(i:i)//"5"//punc(j:j),i=1,lpunc),j=1,lpunc)] do i = 1,size(input) print *,'i=',i,'input(i) = "',input(i),'"' x = 666 read(input(i),*,decimal='point',iostat=ios,iomsg=msg) x print fmt,' with decimal=point x(:) =',x,' ios=',ios ! if(ios/=0) print *,trim(msg) x = 666 read(input(i),*,decimal='comma',iostat=ios,iomsg=msg) x print fmt,' with decimal=comma x(:) =',x,' ios=',ios ! if(ios/=0) 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 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Mon, 16 May 2022 12:49:53 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #13 from Jerry DeLisle --- > With John's multiple combinations test case I get the following r
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #17 from harper at msor dot vuw.ac.nz --- On comparing that with ifort's result I think that the only remaining bug is that if decimal='comma' then '.' is neither a decimal symbol nor a separator (see f2018 13.6). On Mon, 16 May 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Mon, 16 May 2022 00:49:44 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Mon, 16 May 2022 12:49:53 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #13 from Jerry DeLisle --- > With John's multiple combinations test case I get the following results with > the attached patch. All places where we gave an error before the patch, we > give > errors now plus new errors > > $ gfc multi.f90 > $ ./a.out > i= 1 input(i) = "2,5," > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 666.00 ios=5010 > i= 2 input(i) = "2;5," > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 3 input(i) = "2 5," > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 4 input(i) = "2.5," > with decimal=point x(:) = 2.5000 5. ios= -1 > with decimal=comma x(:) = 2.5000 666.00 ios=5010 > i= 5 input(i) = "2,5;" > with decimal=point x(:) = 2. 5. ios=5010 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 6 input(i) = "2;5;" > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 7 input(i) = "2 5;" > with decimal=point x(:) = 2. 5. ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 8 input(i) = "2.5;" > with decimal=point x(:) = 2.5000 5. ios=5010 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 9 input(i) = "2,5 " > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 10 input(i) = "2;5 " > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 11 input(i) = "2 5 " > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 12 input(i) = "2.5 " > with decimal=point x(:) = 2.5000 5. ios= -1 > with decimal=comma x(:) = 2.5000 666.00 ios= -1 > i= 13 input(i) = "2,5." > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 666.00 ios=5010 > i= 14 input(i) = "2;5." > with decimal=point x(:) = 2. 666.00 ios=5010 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 15 input(i) = "2 5." > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 5. ios= 0 > i= 16 input(i) = "2.5." > with decimal=point x(:) = 2. 5. ios=5010 > with decimal=comma x(:) = 2. 666.00 ios=5010 > [jerry@amdr pr105473]$ gfc multi.f90 > [jerry@amdr pr105473]$ ./a.out > i= 1 input(i) = "2,5," > with decimal=point x(:) = 2. 5. ios= 0 > with decimal=comma x(:) = 2. 666.00 ios=5010 > Bad real number in item 1 of list input > i= 2 input(i) = "2;5," > with decimal=point x(:) = 2. 666.00 ios=5010 > Semicolon not allowed as separator with DECIMAL='p
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- 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='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= 8 input(i) = "2.5;" with decimal=point x(:) =2.5 666.0 ios=5010 with decimal=comma x(:) =2.5 666.0 ios=-1 i= 12 input(i) = "2.5 " with decimal=point x(:) =2.5 666.0 ios=-1 with decimal=comma x(:) =2.5 666.0 ios=-1 In these cases the decimal=comma should have never seen 2.5 With ifort: i= 8 input(i) = "2.5;" with decimal=point x(:) = 2.5000 5. ios=5010 with decimal=comma x(:) = 2.5000 666.00 ios= -1 I don't think ifort has the decimal=point part right, as if it backed up and read the digit 5 a second time. Regardless, getting closer here. I will work on the gfortran comma issue.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #19 from harper at msor dot vuw.ac.nz --- Thank you. To make the outputs from my test program testdecimal.f90 easier to compare when using different compilers, and to clarify where a reading 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='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=ios value from reading. Before reading, x=[666,999]. implicit none real x(2) integer ios,i,j character(*),parameter:: punc=",; .",fmt='(1X,A,I2,1X,5A,2F7.1,1X,A)' integer,parameter:: lpunc =len(punc) character:: dec(2)*5=['point','comma'], input(lpunc**2)*4 = & [(("2"//punc(i:i)//"5"//punc(j:j),i=1,lpunc),j=1,lpunc)] do i = 1,size(input) do j = 1,2 x = [666, 999] read(input(i),*,decimal=dec(j),iostat=ios) x print fmt,'i=',i,' input="',input(i),'" with ',dec(j),& ' x =',x,s(ios) end do end do contains character(3) function s(ios) ! ERR, OK ,end if ios>0, ==0, <0 integer,intent(in):: ios s = merge('ERR',merge(' OK','end',ios==0),ios>0) end function s end program john@johns-laptop:~/Jfh$ ifort testdecimal.f90; ./a.out Compiling "ifort testdecimal.f90" i= 1 input="2,5," with point x =2.05.0 OK i= 1 input="2,5," with comma x = 666.0 999.0 ERR i= 2 input="2;5," with point x = 666.0 999.0 ERR i= 2 input="2;5," with comma x =2.05.0 OK i= 3 input="2 5," with point x =2.05.0 OK i= 3 input="2 5," with comma x =2.05.0 OK i= 4 input="2.5," with point x =2.5 999.0 end i= 4 input="2.5," with comma x = 666.0 999.0 ERR i= 5 input="2,5;" with point x =2.0 999.0 ERR i= 5 input="2,5;" with comma x =2.5 999.0 end i= 6 input="2;5;" with point x = 666.0 999.0 ERR i= 6 input="2;5;" with comma x =2.05.0 OK i= 7 input="2 5;" with point x =2.0 999.0 ERR i= 7 input="2 5;" with comma x =2.05.0 OK i= 8 input="2.5;" with point x = 666.0 999.0 ERR i= 8 input="2.5;" with comma x = 666.0 999.0 ERR i= 9 input="2,5 " with point x =2.05.0 OK i= 9 input="2,5 " with comma x =2.5 999.0 end i=10 input="2;5 " with point x = 666.0 999.0 ERR i=10 input="2;5 " with comma x =2.05.0 OK i=11 input="2 5 " with point x =2.05.0 OK i=11 input="2 5 " with comma x =2.05.0 OK i=12 input="2.5 " with point x =2.5 999.0 end i=12 input="2.5 " with comma x = 666.0 999.0 ERR i=13 input="2,5." with point x =2.05.0 OK i=13 input="2,5." with comma x = 666.0 999.0 ERR i=14 input="2;5." with point x = 666.0 999.0 ERR i=14 input="2;5." with comma x =2.0 999.0 ERR i=15 input="2 5." with point x =2.05.0 OK i=15 input="2 5." with comma x =2.0 999.0 ERR i=16 input="2.5." with point x = 666.0 999.0 ERR i=16 input="2.5." with comma x = 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 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Wed, 18 May 2022 14:52:38 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- 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='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= 8 input(i) = "2.5;" > with decimal=point x(:) =2.5 666.0 ios=5010 > with decimal=comma x(:) =2.5 666.0 ios=-1 > > i= 12
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #20 from Jerry DeLisle --- Please check this. Second pair of eyes needed. $ ./a.out i= 1 input="2,5," with point x =2.05.0 OK i= 1 input="2,5," with comma x = 666.0 999.0 ERR i= 2 input="2;5," with point x =2.0 999.0 ERR i= 2 input="2;5," with comma x =2.05.0 OK i= 3 input="2 5," with point x =2.05.0 OK i= 3 input="2 5," with comma x =2.05.0 OK i= 4 input="2.5," with point x =2.5 999.0 end i= 4 input="2.5," with comma x = 666.0 999.0 ERR i= 5 input="2,5;" with point x =2.05.0 ERR i= 5 input="2,5;" with comma x =2.5 999.0 end i= 6 input="2;5;" with point x =2.0 999.0 ERR i= 6 input="2;5;" with comma x =2.05.0 OK i= 7 input="2 5;" with point x =2.05.0 ERR i= 7 input="2 5;" with comma x =2.05.0 OK i= 8 input="2.5;" with point x =2.5 999.0 ERR i= 8 input="2.5;" with comma x = 666.0 999.0 ERR i= 9 input="2,5 " with point x =2.05.0 OK i= 9 input="2,5 " with comma x =2.5 999.0 end i=10 input="2;5 " with point x =2.0 999.0 ERR i=10 input="2;5 " with comma x =2.05.0 OK i=11 input="2 5 " with point x =2.05.0 OK i=11 input="2 5 " with comma x =2.05.0 OK i=12 input="2.5 " with point x =2.5 999.0 end i=12 input="2.5 " with comma x = 666.0 999.0 ERR i=13 input="2,5." with point x =2.05.0 OK i=13 input="2,5." with comma x = 666.0 999.0 ERR i=14 input="2;5." with point x =2.0 999.0 ERR i=14 input="2;5." with comma x =2.0 999.0 ERR i=15 input="2 5." with point x =2.05.0 OK i=15 input="2 5." with comma x =2.0 999.0 ERR i=16 input="2.5." with point x = 666.0 999.0 ERR i=16 input="2.5." with comma x = 666.0 999.0 ERR
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #21 from harper at msor dot vuw.ac.nz --- I have only one problem here, and it's with the f2018 standard seeming to contradict itself in two places that both apply to this program. 12.11.1 begins "The set of input/output error conditions is processor dependent. Except as otherwise specified, when an error condition occurs or is detected is processor dependent." 12.11.2 (6) says "if the statement is a READ statement or the error condition occurs in a wait operation for a transfer initiated by a READ statement, all input items or namelist group objects in the statement that initiated the transfer become undefined;" In the 3rd case below, the output i== 2 input="2;5," with point x = 2.0 999.0 ERR seems to me OK by 12.11.1 (error condition occurring after reading x(1) as 2.0) but 12.11.2 seems to imply that neither x(1) nor x(2) should be read, making the output i= 2 input="2;5," with point x = 666.0 999.0 ERR That is what ifort did with the program, but if the standard is ambiguous I can't complain if gfortran and ifort interpret it differently. There is of course also the cop-out that if the program is not standard-compliant then compilers can do what they like with it. The other cases where gfortran and ifort disagreed are listed below. They all involve point and ERR. I give the gfortran result first then the ifort result. i= 5 input="2,5;" with point x =2.05.0 ERR i= 5 input="2,5;" with point x =2.0 999.0 ERR i= 6 input="2;5;" with point x =2.0 999.0 ERR i= 6 input="2;5;" with point x = 666.0 999.0 ERR i= 7 input="2 5;" with point x =2.05.0 ERR i= 7 input="2 5;" with point x =2.0 999.0 ERR i= 8 input="2.5;" with point x =2.5 999.0 ERR i= 8 input="2.5;" with point x = 666.0 999.0 ERR i=10 input="2;5 " with point x =2.0 999.0 ERR i=10 input="2;5 " with point x = 666.0 999.0 ERR i=14 input="2;5." with point x =2.0 999.0 ERR i=14 input="2;5." with point x = 666.0 999.0 ERR Oddly, there was one point and ERR case where gfortran agreed with ifort: i=16 input="2.5." with point x = 666.0 999.0 ERR I wish I still had access to the NAG compiler! > Date: Fri, 3 Jun 2022 04:33:33 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Fri, 3 Jun 2022 16:33:45 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #20 from Jerry DeLisle --- > Please check this. Second pair of eyes needed. > > $ ./a.out > i= 1 input="2,5," with point x =2.05.0 OK > i= 1 input="2,5," with comma x = 666.0 999.0 ERR > > i= 2 input="2;5," with point x =2.0 999.0 ERR > i= 2 input="2;5," with comma x =2.05.0 OK > > i= 3 input="2 5," with point x =2.05.0 OK > i= 3 input="2 5," with comma x =2.05.0 OK > > i= 4 input="2.5," with point x =2.5 999.0 end > i= 4 input="2.5," with comma x = 666.0 999.0 ERR > > i= 5 input="2,5;" with point x =2.05.0 ERR > i= 5 input="2,5;" with comma x =2.5 999.0 end > > i= 6 input="2;5;" with point x =2.0 999.0 ERR > i= 6 input="2;5;" with comma x =2.05.0 OK > > i= 7 input="2 5;" with point x =2.05.0 ERR > i= 7 input="2 5;" with comma x =2.05.0 OK > > i= 8 input="2.5;" with point x =2.5 999.0 ERR > i= 8 input="2.5;" with comma x = 666.0 999.0 ERR > > i= 9 input="2,5 " with point x =2.05.0 OK > i= 9 input="2,5 " with comma x =2.5 999.0 end > > i=10 input="2;5 " with point x =2.0 999.0 ERR > i=10 input="2;5 " with comma x =2.05.0 OK > > i=11 input="2 5 " with point x =2.05.0 OK > i=11 input="2 5 " with comma x =2.05.0 OK > > i=12 input="2.5 " with point x =2.5 999.0 end > i=12 input="2.5 " with comma x = 666.0 999.0 ERR > > i=13 input="2,5." with point x =2.05.0 OK > i=13 input="2,5." with comma x = 666.0 999.0 ERR > > i=14 input="2;5." with point x =2.0 999.0 ERR > i=14 input="2;5." with comma x =2.0 999.0 ERR > > i=15 input="2 5." with point x =2.05.0 OK > i=15 input="2 5." with comma x =2.0 999.0 ERR > > i=16 input="2.5." with point x = 666.0 999.0 ERR > i=16 input="2.5." with comma x = 666.0 999.0 ERR > > -- > 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.har...@vuw.ac.nz phone +64(0) 4 463 5276
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #22 from Jerry DeLisle --- 12.11.2 (6) says "if the statement is a READ statement or the error condition occurs in a wait operation for a transfer initiated by a READ statement, all input items or namelist group objects in the statement that initiated the transfer become undefined;" By undefined, it means you cant rely on it whether or not it has a value read into it or not. It is undefined by the standard and to the user, so it could be anything, There was one last place I am going to check in the code before I am done. (maybe ;)) Regarding NAG, yes we always use to like to see that interpretation.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #23 from harper at msor dot vuw.ac.nz --- Given what "undefined" means in Fortran, I see no bug now. On Fri, 3 Jun 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Fri, 3 Jun 2022 21:04:22 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Sat, 4 Jun 2022 09:04:35 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #22 from Jerry DeLisle --- > 12.11.2 (6) says "if the statement is a READ statement or the error > condition occurs in a wait operation for a transfer initiated by a READ > statement, all input items or namelist group objects in the statement that > initiated the transfer become undefined;" > > By undefined, it means you cant rely on it whether or not it has a value read > into it or not. It is undefined by the standard and to the user, so it could > be anything, > > There was one last place I am going to check in the code before I am done. > (maybe ;)) > > Regarding NAG, yes we always use to like to see that interpretation. > > -- > 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.har...@vuw.ac.nz phone +64(0) 4 463 5276
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 Jerry DeLisle changed: What|Removed |Added Attachment #52981|0 |1 is obsolete|| --- Comment #24 from Jerry DeLisle --- Created attachment 53241 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53241&action=edit Revised patch that may be as good as it gets. I have not had time to commit this, but this would be it. If you can test it and point out any issues it is appreciated.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #25 from harper at msor dot vuw.ac.nz --- I received your patch but I have no idea how to install it - I have been using Fortran off and on since 1963 but I am not a systems programmer. My version of gfortran is gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) On Sat, 2 Jul 2022, jvdelisle at gcc dot gnu.org wrote: > Date: Sat, 2 Jul 2022 17:14:05 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Sun, 3 Jul 2022 05:14:17 +1200 (NZST) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > Jerry DeLisle changed: > > What|Removed |Added > > Attachment #52981|0 |1 >is obsolete|| > > --- Comment #24 from Jerry DeLisle --- > Created attachment 53241 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53241&action=edit > Revised patch that may be as good as it gets. > > I have not had time to commit this, but this would be it. If you can test it > and point out any issues it is appreciated. > > -- > 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.har...@vuw.ac.nz phone +64(0) 4 463 5276
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #26 from Jerry DeLisle --- I will be comitting it to trunk which is rev 13 if approved. John, I was not expecting you to do anything. Since all my time on this is unpaid volunteer work, I get to it when I have time. I am not sure we will get it backported to rev 9. Will see as I get there.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #27 from GCC Commits --- The master branch has been updated by Jerry DeLisle : https://gcc.gnu.org/g:a71d87431d0c4e04a402ef6566be090c470b2b53 commit r14-9050-ga71d87431d0c4e04a402ef6566be090c470b2b53 Author: Jerry DeLisle Date: Sat Feb 17 09:24:58 2024 -0800 libgfortran: [PR105473] Fix checks for decimal='comma'. PR libfortran/105473 libgfortran/ChangeLog: * io/list_read.c (eat_separator): Reject comma as a seprator when it is being used as a decimal point. (parse_real): Reject a '.' when is should be a comma. (read_real): Likewise. * io/read.c (read_f): Add more checks for ',' and '.' conditions. gcc/testsuite/ChangeLog: * gfortran.dg/pr105473.f90: New test.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #28 from GCC Commits --- The releases/gcc-13 branch has been updated by Jerry DeLisle : https://gcc.gnu.org/g:7ecea49245bc6aeb6c889a4914961f94417f16e5 commit r13-8411-g7ecea49245bc6aeb6c889a4914961f94417f16e5 Author: Jerry DeLisle Date: Sat Feb 17 09:24:58 2024 -0800 libgfortran: [PR105473] Fix checks for decimal='comma'. PR libfortran/105473 libgfortran/ChangeLog: * io/list_read.c (eat_separator): Reject comma as a separator when it is being used as a decimal point. (parse_real): Reject a '.' when it should be a comma. (read_real): Likewise. * io/read.c (read_f): Add more checks for ',' and '.' conditions. gcc/testsuite/ChangeLog: * gfortran.dg/pr105473.f90: New test. (cherry picked from commit a71d87431d0c4e04a402ef6566be090c470b2b53)
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #29 from Jerry DeLisle --- Backported to 13 and closing.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #30 from john.harper at vuw dot ac.nz --- Thank you! On Fri, 8 Mar 2024, jvdelisle at gcc dot gnu.org wrote: > Date: Fri, 8 Mar 2024 00:30:51 + > From: jvdelisle at gcc dot gnu.org > To: John Harper > Subject: [Bug fortran/105473] semicolon allowed when list-directed read > integer with decimal='point' > Resent-Date: Fri, 8 Mar 2024 13:31:02 +1300 (NZDT) > Resent-From: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 > > --- Comment #29 from Jerry DeLisle --- > Backported to 13 and closing. > > -- > 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.har...@vuw.ac.nz
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #31 from Jerry DeLisle --- (In reply to john.harper from comment #30) > Thank you! > I encourage folks to move to gcc/gfortran 13. However, if you need it on 12, I can do so.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 Tobias Burnus changed: What|Removed |Added CC||burnus at gcc dot gnu.org --- Comment #32 from Tobias Burnus --- See PR114304 for an issue that was caused by the fix in comment 27.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #33 from Jerry DeLisle --- (In reply to Tobias Burnus from comment #32) > See PR114304 for an issue that was caused by the fix in comment 27. Reverted portion of offending commit to fix.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #34 from Tobias Burnus --- Created attachment 57693 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57693&action=edit Extended testcase; comment shows results for gfortran(trunk),ifort,ifx,flang See PR114304 for some related issue where too much is rejected while this one is about too much getting accepted. I now tried an extended version of comment 0, see below and see https://godbolt.org/z/GKzc4sveK for the result with gfortran, ifort, ifx and flag. I have to admit that I do not really see a real pattern here, comparing the compilers. One quote from F2023 can be found at bug 114304 comment 14.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 Tobias Burnus changed: What|Removed |Added Attachment #57693|0 |1 is obsolete|| --- Comment #35 from Tobias Burnus --- Created attachment 57695 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57695&action=edit Extended testcase; comment shows results for gfortran(trunk),ifort,ifx,flang Fixed testcase – before: too many lines commented, bugs with floating-point test string fo decimal=comma the I/O code in general for floating-point case. See also: https://godbolt.org/z/14h48167W See also some comments at bug 114304 comment 19.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #36 from Jerry DeLisle --- Created attachment 57854 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57854&action=edit Modified extended test case I modified the extended test case so I could review this and summarize. Currently this is what we get with my comments at the end of each line. I marked some that I think are clearly incorrect. Maybe OK depends on on strictly one chooses to interpret what the standard says. If we assume that one or more spaces is an acceptable separator if followed by a non-value I indicate those with the word space. comma, isreal = F, testinput = ; n= 42 ios=0 OK, null read point, isreal = F, testinput = ; n= 42 ios=0 maybe OK comma, isreal = F, testinput = , n= 42 ios= 5010 OK, error point, isreal = F, testinput = , n= 42 ios=0 OK, null read comma, isreal = F, testinput = . n= 42 ios= 5010 OK, error point, isreal = F, testinput = . n= 42 ios= 5010 OK, error comma, isreal = F, testinput = 5. n= 42 ios= 5010 OK, error point, isreal = F, testinput = 5. n= 42 ios= 5010 OK, error comma, isreal = F, testinput = 5, n= 42 ios= 5010 OK, error point, isreal = F, testinput = 5, n= 5 ios=0 OK, good read comma, isreal = F, testinput = 5; n= 5 ios=0 OK, good read point, isreal = F, testinput = 5; n= 5 ios=0 maybe OK comma, isreal = F, testinput =7 . n= 7 ios=0 OK, good read space point, isreal = F, testinput =7 . n= 7 ios=0 OK, good read space comma, isreal = F, testinput =7 , n= 42 ios= 5010 Incorrect point, isreal = F, testinput =7 , n= 7 ios=0 OK, good read comma, isreal = F, testinput =7 ; n= 7 ios=0 OK, good read space point, isreal = F, testinput =7 ; n= 7 ios=0 OK, good read space comma, isreal = T, testinput = 8. r= 42.00 ios= 5010 OK, error point, isreal = T, testinput = 8. r= 8.00 ios=0 OK, good read comma, isreal = T, testinput = 8, r= 8.00 ios=0 OK, good read point, isreal = T, testinput = 8, r= 8.00 ios=0 OK, good read comma, isreal = T, testinput = 8; r= 8.00 ios=0 OK, good read point, isreal = T, testinput = 8; r= 8.00 ios=0 maybe OK comma, isreal = T, testinput =9 . r= 9.00 ios=0 OK, good read space point, isreal = T, testinput =9 . r= 9.00 ios=0 OK, good read space comma, isreal = T, testinput =9 , r= 9.00 ios= 5010 Incorrect, space? point, isreal = T, testinput =9 , r= 9.00 ios=0 OK, good read comma, isreal = T, testinput =9 ; r= 9.00 ios=0 OK, good read point, isreal = T, testinput =9 ; r= 9.00 ios=0 maybe OK comma, isreal = T, testinput = 3,3. r= 42.00 ios= 5010 OK, error point, isreal = T, testinput = 3.3. r= 42.00 ios= 5010 OK, error comma, isreal = T, testinput = 3,3, r= 42.00 ios= 5010 OK, error comma, isreal = T, testinput = 3,3; r= 3.30 ios=0 OK, good read point, isreal = T, testinput = 3.3; r= 3.30 ios=0 maybe OK comma, isreal = T, testinput = 4,4 . r= 4.40 ios=0 OK, good read space point, isreal = T, testinput = 4.4 . r= 4.40 ios=0 OK, goor read space comma, isreal = T, testinput = 4,4 , r= 4.40 ios= 5010 Incorrect, space? point, isreal = T, testinput = 4.4 , r= 4.40 ios=0 OK, good read comma, isreal = T, testinput = 4,4 ; r= 4.40 ios=0 OK, good read point, isreal = T, testinput = 4.4 ; r= 4.40 ios=0 OK, good read space I have a followup comment on this.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #37 from Jerry DeLisle --- Created attachment 57855 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57855&action=edit Preliminary patch to address some incorrect behavior This attached patch, gives some better results for the testcase in the previous commenr. $ ./a.out comma, isreal = F, testinput = ; n= 42 ios=0 point, isreal = F, testinput = ; n= 42 ios=0 comma, isreal = F, testinput = , n= 42 ios= 5010 point, isreal = F, testinput = , n= 42 ios=0 comma, isreal = F, testinput = . n= 42 ios= 5010 point, isreal = F, testinput = . n= 42 ios= 5010 comma, isreal = F, testinput = 5. n= 42 ios= 5010 point, isreal = F, testinput = 5. n= 42 ios= 5010 comma, isreal = F, testinput = 5, n= 42 ios= 5010 point, isreal = F, testinput = 5, n= 5 ios=0 comma, isreal = F, testinput = 5; n= 5 ios=0 point, isreal = F, testinput = 5; n= 5 ios=0 comma, isreal = F, testinput =7 . n= 7 ios=0 point, isreal = F, testinput =7 . n= 7 ios=0 comma, isreal = F, testinput =7 , n= 7 ios=0 point, isreal = F, testinput =7 , n= 7 ios=0 comma, isreal = F, testinput =7 ; n= 7 ios=0 point, isreal = F, testinput =7 ; n= 7 ios=0 comma, isreal = T, testinput = 8. r= 42.00 ios= 5010 point, isreal = T, testinput = 8. r= 8.00 ios=0 comma, isreal = T, testinput = 8, r= 8.00 ios=0 point, isreal = T, testinput = 8, r= 8.00 ios=0 comma, isreal = T, testinput = 8; r= 8.00 ios=0 point, isreal = T, testinput = 8; r= 8.00 ios=0 comma, isreal = T, testinput =9 . r= 9.00 ios=0 point, isreal = T, testinput =9 . r= 9.00 ios=0 comma, isreal = T, testinput =9 , r= 9.00 ios=0 point, isreal = T, testinput =9 , r= 9.00 ios=0 comma, isreal = T, testinput =9 ; r= 9.00 ios=0 point, isreal = T, testinput =9 ; r= 9.00 ios=0 comma, isreal = T, testinput = 3,3. r= 42.00 ios= 5010 point, isreal = T, testinput = 3.3. r= 42.00 ios= 5010 comma, isreal = T, testinput = 3,3, r= 42.00 ios= 5010 comma, isreal = T, testinput = 3,3; r= 3.30 ios=0 point, isreal = T, testinput = 3.3; r= 3.30 ios=0 comma, isreal = T, testinput = 4,4 . r= 4.40 ios=0 point, isreal = T, testinput = 4.4 . r= 4.40 ios=0 comma, isreal = T, testinput = 4,4 , r= 4.40 ios=0 point, isreal = T, testinput = 4.4 , r= 4.40 ios=0 comma, isreal = T, testinput = 4,4 ; r= 4.40 ios=0 point, isreal = T, testinput = 4.4 ; r= 4.40 ios=0
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #38 from GCC Commits --- The master branch has been updated by Jerry DeLisle : https://gcc.gnu.org/g:93adf88cc6744aa2c732b765e1e3b96e66cb3300 commit r14-9822-g93adf88cc6744aa2c732b765e1e3b96e66cb3300 Author: Jerry DeLisle Date: Fri Apr 5 19:25:13 2024 -0700 libfortran: Fix handling of formatted separators. PR libfortran/114304 PR libfortran/105473 libgfortran/ChangeLog: * io/list_read.c (eat_separator): Add logic to handle spaces preceding a comma or semicolon such that that a 'null' read occurs without error at the end of comma or semicolon terminated input lines. Add check and error message for ';'. (list_formatted_read_scalar): Treat comma as a decimal point when specified by the decimal mode on the first item. gcc/testsuite/ChangeLog: * gfortran.dg/pr105473.f90: Modify to verify new error message. * gfortran.dg/pr114304.f90: New test.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 --- Comment #39 from GCC Commits --- The releases/gcc-13 branch has been updated by Jerry DeLisle : https://gcc.gnu.org/g:b55a35bcc80a7402576556c2f9d161229fb220ef commit r13-8640-gb55a35bcc80a7402576556c2f9d161229fb220ef Author: Jerry DeLisle Date: Sun Apr 21 20:50:26 2024 -0700 libfortran: Fix handling of formatted separators. Backport from mainline. PR libfortran/114304 PR libfortran/105473 libgfortran/ChangeLog: * io/list_read.c (eat_separator): Add logic to handle spaces preceding a comma or semicolon such that that a 'null' read occurs without error at the end of comma or semicolon terminated input lines. Add check and error message for ';'. Accept tab as alternative to space. (list_formatted_read_scalar): Treat comma as a decimal point when specified by the decimal mode on the first item. gcc/testsuite/ChangeLog: * gfortran.dg/pr105473.f90: Modify for revised checks. * gfortran.dg/pr114304-2.f90: New test. * gfortran.dg/pr114304.f90: New test.
[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473 Jerry DeLisle changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #40 from Jerry DeLisle --- Fixed on 13 and mainline (14)