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 +0000
> From: jvdelisle at gcc dot gnu.org <gcc-bugzi...@gcc.gnu.org>
> To: John Harper <john.har...@vuw.ac.nz>
> 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: <john.har...@vuw.ac.nz>
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473
>
> --- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> 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

Reply via email to