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

--- Comment #11 from harper at msor dot vuw.ac.nz ---
Thank you Jerry. Commas as separators with DECIMAL = 'comma' may be 
trickier because commas then do the job that decimal points normally do,
and they cannot act as separators.

Here is a little test program that reads from all 16 of "2p5q" where
p and q are comma,semicolon,blank, or point, using both 'comma' and 
'point'. It gave me the same 60 lines of output with -std=f2003 or 
-std=f2018

! Does list-directed reading work properly with decimal='comma' ?
   implicit none
   real x(2)
   character(*),parameter:: punc = ",; ."
   integer,parameter:: lpunc =len(punc)
   integer ios,i,j
   character:: msg*80, input(lpunc**2)*4 = &
        [(("2"//punc(i:i)//"5"//punc(j:j),i=1,lpunc),j=1,lpunc)]

   do i = 1,size(input)
      print *,'i=',i,'input(i) = "',input(i),'"'
      read(input(i),*,decimal='point',iostat=ios,iomsg=msg) x
      print *,'with decimal=point x(:) =',x,' ios=',ios
      if(ios/=0) print *,trim(msg)
      x(2) = 666
      read(input(i),*,decimal='comma',iostat=ios,iomsg=msg) x
      print *,'with decimal=comma x(:) =',x,' ios=',ios
      if(ios/=0) print *,trim(msg)
   end do
end program

On Sun, 15 May 2022, jvdelisle at gcc dot gnu.org wrote:

> Date: Sun, 15 May 2022 15:56:00 +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: Mon, 16 May 2022 03:56:12 +1200 (NZST)
> Resent-From: <john.har...@vuw.ac.nz>
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105473
>
> --- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> Just completed good regression testing and have this:
>
> testinput = "1;17;3.14159        "
> At line 8 of file pr105473.f90
> Fortran runtime error: Semicolon not allowed as separator with DECIMAL='point'
>
> Now I wonder if I should likewise do the same for the other case with
> DECIMAL='comma' and we find a 'comma' separator.
>
> -- 
> 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