public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "harper at msor dot vuw.ac.nz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/105473] semicolon allowed when list-directed read integer with decimal='point'
Date: Sun, 15 May 2022 08:59:18 +0000	[thread overview]
Message-ID: <bug-105473-4-VH8nQGLEw4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105473-4@http.gcc.gnu.org/bugzilla/>

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-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: Sun, 15 May 2022 10:00:21 +1200 (NZST)
> Resent-From: <john.harper@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.harper@vuw.ac.nz phone +64(0) 4 463 5276

  parent reply	other threads:[~2022-05-15  8:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04  8:38 [Bug fortran/105473] New: " john.harper at vuw dot ac.nz
2022-05-05  2:14 ` [Bug fortran/105473] " jvdelisle2 at gmail dot com
2022-05-05  2:21 ` jvdelisle2 at gmail dot com
2022-05-05  2:50 ` harper at msor dot vuw.ac.nz
2022-05-06  1:26 ` jvdelisle2 at gmail dot com
2022-05-06 20:39 ` anlauf at gcc dot gnu.org
2022-05-08 14:54 ` jvdelisle at gcc dot gnu.org
2022-05-14 22:00 ` jvdelisle at gcc dot gnu.org
2022-05-15  8:59 ` harper at msor dot vuw.ac.nz [this message]
2022-05-15 14:37 ` jvdelisle at gcc dot gnu.org
2022-05-15 15:56 ` jvdelisle at gcc dot gnu.org
2022-05-16  0:10 ` harper at msor dot vuw.ac.nz
2022-05-16  0:42 ` jvdelisle at gcc dot gnu.org
2022-05-16  0:49 ` jvdelisle at gcc dot gnu.org
2022-05-16  0:55 ` jvdelisle at gcc dot gnu.org
2022-05-16  1:44 ` harper at msor dot vuw.ac.nz
2022-05-16  4:12 ` harper at msor dot vuw.ac.nz
2022-05-16 21:13 ` harper at msor dot vuw.ac.nz
2022-05-18  2:52 ` jvdelisle at gcc dot gnu.org
2022-05-19  0:10 ` harper at msor dot vuw.ac.nz
2022-06-03  4:33 ` jvdelisle at gcc dot gnu.org
2022-06-03  9:11 ` harper at msor dot vuw.ac.nz
2022-06-03 21:04 ` jvdelisle at gcc dot gnu.org
2022-06-04  3:47 ` harper at msor dot vuw.ac.nz
2022-07-02 17:14 ` jvdelisle at gcc dot gnu.org
2022-07-03  3:52 ` harper at msor dot vuw.ac.nz
2022-07-04  3:48 ` jvdelisle at gcc dot gnu.org
2024-02-17 18:04 ` cvs-commit at gcc dot gnu.org
2024-03-08  0:29 ` cvs-commit at gcc dot gnu.org
2024-03-08  0:30 ` jvdelisle at gcc dot gnu.org
2024-03-08  7:21 ` john.harper at vuw dot ac.nz
2024-03-09 19:12 ` jvdelisle at gcc dot gnu.org
2024-03-11 12:48 ` burnus at gcc dot gnu.org
2024-03-11 22:48 ` jvdelisle at gcc dot gnu.org
2024-03-14  8:40 ` burnus at gcc dot gnu.org
2024-03-14  9:16 ` burnus at gcc dot gnu.org
2024-04-03  3:36 ` jvdelisle at gcc dot gnu.org
2024-04-03  3:50 ` jvdelisle at gcc dot gnu.org
2024-04-06 13:56 ` cvs-commit at gcc dot gnu.org
2024-04-22  4:23 ` cvs-commit at gcc dot gnu.org
2024-04-22  4:25 ` jvdelisle at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105473-4-VH8nQGLEw4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).