[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
Fri Jun 3 09:11:45 GMT 2022
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.0 5.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.0 5.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 +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: Fri, 3 Jun 2022 16:33:45 +1200 (NZST)
> Resent-From: <john.harper@vuw.ac.nz>
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473
>
> --- Comment #20 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> Please check this. Second pair of eyes needed.
>
> $ ./a.out
> i= 1 input="2,5," with point x = 2.0 5.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.0 5.0 OK
>
> i= 3 input="2 5," with point x = 2.0 5.0 OK
> i= 3 input="2 5," with comma x = 2.0 5.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 5.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.0 5.0 OK
>
> i= 7 input="2 5;" with point x = 2.0 5.0 ERR
> i= 7 input="2 5;" with comma x = 2.0 5.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.0 5.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.0 5.0 OK
>
> i=11 input="2 5 " with point x = 2.0 5.0 OK
> i=11 input="2 5 " with comma x = 2.0 5.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.0 5.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.0 5.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.harper@vuw.ac.nz phone +64(0) 4 463 5276
More information about the Gcc-bugs
mailing list