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

            Bug ID: 109080
           Summary: A write of a NAMELIST group containing an allocatable
                    array is incorrect
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: urbanjost at comcast dot net
  Target Milestone: ---

Sometimes it runs and writes out ALINES incorrectly,
and sometimes the same executable segfaults.

program gnubug
implicit none
character(len=2) :: lines(3)
character(len=2),allocatable :: blines(:) 
character(len=:),allocatable :: alines(:) 
namelist/args/lines, alines, blines
   lines  = ['Xx','Yy','Zz']
   alines = ['Xx','Yy','Zz']
   blines = ['Xx','Yy','Zz']
   write(*,nml=args,delim='quote')
end program gnubug

gfortran xx.f90
$ ./a.out
&ARGS
 LINES="Xx","Yy","Zz",
 ALINES= 3*"Xx",
 BLINES="Xx","Yy","Zz",
 /

./a.out
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x1516241f9700 in ???
#1  0x1516241f88a5 in ???
#2  0x15162402908f in ???
        at
/build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
#3  0x151624173590 in ???
        at ../sysdeps/x86_64/multiarch/memcmp-sse4.S:72
#4  0x15162443c187 in ???
#5  0x15162443cece in ???
#6  0x151624432974 in ???
#7  0x151624432d01 in ???
#8  0x55c8983f77d8 in ???
#9  0x55c8983f7821 in ???
#10  0x15162400a082 in __libc_start_main
        at ../csu/libc-start.c:308
#11  0x55c8983f710d in ???
#12  0xffffffffffffffff in ???

Reply via email to