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

            Bug ID: 101627
           Summary: List-directed read with trailing characters after
                    quotes
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hj8758558 at gmail dot com
  Target Milestone: ---

When reading a string delimited by single quotes, but followed by a non-blank
character, gfortran takes the "err" branch. This is in contrast to ifort,
nagfor, and flang, which read the string within the quotes and ignore the
trailing character(s).

Is gfortran's behavior intended?



$ cat test.f90
program test                               

   character(len=6) :: input_str = "'abc'a"
   character(len=6) :: output_str          

   read (input_str, *, err=77) output_str  

   stop 'No read error'                    

77 continue                                
   stop 'Read error'                       

end program test                           


$ gfortran test.f90 && ./a.out
STOP Read error

Reply via email to