https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114304

--- Comment #14 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 57680
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57680&action=edit
Testcase with decimal=COMMA, passes with ifort/ifx/flang - fails with gfortran

> commit r14-9432-g0c179654c3170749f3fb3232f2442fcbc99bffbb
> commit r13-8417-g824a71f609b37a8121793075b175e2bbe14fdb82

Thanks for the fix.

We are now back to the GCC 13 result → comment 4

Namely, attachment 57668 now gives:

   1.23434997       1243.23999       13.2399998     a
   1.23434997       1243.23999       13.2399998     a
   1.23434997       1243.23999       13.2399998    
   1.23434997       1243.23999       13.2399998    
At line 33 of file foo.f90 (unit = 99, file = 'foo.inp')

* * *

The question is whether the following show give an error as shown above:
  real :: x(3)
  character(len=1) :: s
  ...
  write(99, '(a)') '1.23435 1243.24 13.24 ;'
  read(99, *) x, s

Or whether reading this line should work, i.e. reading ';' as character – as it
does with ifort and flang.

Or in other words:
* Does ';' count as character, readable by list-directed formatted I/O? (ifort,
ifx, flang)
* Or doesn't it? (gfortran since at least 4.9)

* * *

In F2023 (23-007r1), "13.10.2 Values and value separators":

"A value separator is
 • 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,
 • a slash optionally preceded by one or more contiguous blanks and
   optionally followed by one or more contiguous blanks, or
 • one or more contiguous blanks between two nonblank values
   or following the last nonblank value, where a nonblank value
   is a constant, an r*c form, or an r* form."

(where 'r' is an positive integer and 'c' is a literal constant [with ...].)


To me it reads as if the semicolon should be read just fine.

* * *

I now have tried another testcase with decimal=COMMA, which works just fine
with ifort / ifx /flang as shown at
  https://godbolt.org/z/ajeTjzEfY

But with GCC it fails with:
  Fortran runtime error: Comma not allowed as separator with DECIMAL='comma'

See godbolt link above for gfortran vs. ifort vs. ifx. vs. flang
or the attached testcase.

Reply via email to