[Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
harper at msor dot vuw.ac.nz
gcc-bugzilla@gcc.gnu.org
Mon May 16 04:12:35 GMT 2022
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.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 <gcc-bugzilla@gcc.gnu.org>
To: John Harper <john.harper@vuw.ac.nz>
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: <john.harper@vuw.ac.nz>
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 +0000
> From: jvdelisle at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> To: John Harper <john.harper@vuw.ac.nz>
> 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: <john.harper@vuw.ac.nz>
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473
>
> --- Comment #13 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> 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.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 666.000000 ios= 5010
> i= 2 input(i) = "2;5,"
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 3 input(i) = "2 5,"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 4 input(i) = "2.5,"
> with decimal=point x(:) = 2.50000000 5.00000000 ios= -1
> with decimal=comma x(:) = 2.50000000 666.000000 ios= 5010
> i= 5 input(i) = "2,5;"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 5010
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> i= 6 input(i) = "2;5;"
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 7 input(i) = "2 5;"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 5010
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 8 input(i) = "2.5;"
> with decimal=point x(:) = 2.50000000 5.00000000 ios= 5010
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> i= 9 input(i) = "2,5 "
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> i= 10 input(i) = "2;5 "
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 11 input(i) = "2 5 "
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 12 input(i) = "2.5 "
> with decimal=point x(:) = 2.50000000 5.00000000 ios= -1
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> i= 13 input(i) = "2,5."
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 666.000000 ios= 5010
> i= 14 input(i) = "2;5."
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 15 input(i) = "2 5."
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 16 input(i) = "2.5."
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 5010
> with decimal=comma x(:) = 2.00000000 666.000000 ios= 5010
> [jerry@amdr pr105473]$ gfc multi.f90
> [jerry@amdr pr105473]$ ./a.out
> i= 1 input(i) = "2,5,"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 666.000000 ios= 5010
> Bad real number in item 1 of list input
> i= 2 input(i) = "2;5,"
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 3 input(i) = "2 5,"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 4 input(i) = "2.5,"
> with decimal=point x(:) = 2.50000000 5.00000000 ios= -1
> End of file
> with decimal=comma x(:) = 2.50000000 666.000000 ios= 5010
> Bad real number in item 1 of list input
> i= 5 input(i) = "2,5;"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> End of file
> i= 6 input(i) = "2;5;"
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 7 input(i) = "2 5;"
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 8 input(i) = "2.5;"
> with decimal=point x(:) = 2.50000000 5.00000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> End of file
> i= 9 input(i) = "2,5 "
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> End of file
> i= 10 input(i) = "2;5 "
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 11 input(i) = "2 5 "
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 12 input(i) = "2.5 "
> with decimal=point x(:) = 2.50000000 5.00000000 ios= -1
> End of file
> with decimal=comma x(:) = 2.50000000 666.000000 ios= -1
> End of file
> i= 13 input(i) = "2,5."
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 666.000000 ios= 5010
> Bad real number in item 1 of list input
> i= 14 input(i) = "2;5."
> with decimal=point x(:) = 2.00000000 666.000000 ios= 5010
> Semicolon not allowed as separator with DECIMAL='point'
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 15 input(i) = "2 5."
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 0
> with decimal=comma x(:) = 2.00000000 5.00000000 ios= 0
> i= 16 input(i) = "2.5."
> with decimal=point x(:) = 2.00000000 5.00000000 ios= 5010
> Bad real number in item 1 of list input
> with decimal=comma x(:) = 2.00000000 666.000000 ios= 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
More information about the Gcc-bugs
mailing list