[Bug fortran/99711] Crash when reading an allocated character array in namelist

jvdelisle at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 23 02:29:12 GMT 2021


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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |---
   Last reconfirmed|                            |2021-03-23
             Status|RESOLVED                    |NEW
     Ever confirmed|0                           |1

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to kargl from comment #2)
> (In reply to Jerry DeLisle from comment #1)
> > F2018 standard section 13.10.3 List-directed Input
> > 
> > There is a note NOTE 13.29 at the end of the first sub-section 13.10.3.1"
> > 
> > "An allocatable, deferred-length character effective item does not have its
> > allocation status or allocated length changed as a result of list-directed
> > input."
> > 
> > This implies that if the strings of the array are not already allocated to a
> > resonable length, for example a string of blanks, then the read will attempt
> > to transfer the file contents into unallocated strings.
> 
> Doesn't the line
> 
>  allocate( character(len=10) :: cbulist_ru(5) )
> 
> that is the first executable statement in the program
> allocate an array of 5 strings with length 10?

You are right Steve, tired eyes were "seeing" only the declaration.  In that
case this should be OK and I do see the segfault.  It is likely a front end
issue.


More information about the Gcc-bugs mailing list