[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
Thu May 5 02:50:26 GMT 2022
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 +0000
> From: jvdelisle2 at gmail dot com <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: Thu, 5 May 2022 14:14:52 +1200 (NZST)
> Resent-From: <john.harper@vuw.ac.nz>
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473
>
> Jerry DeLisle <jvdelisle2 at gmail dot com> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |jvdelisle2 at gmail dot com
>
> --- Comment #1 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
> 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.harper@vuw.ac.nz phone +64(0) 4 463 5276
More information about the Gcc-bugs
mailing list