public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "urbanjost at comcast dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/109080] New: A write of a NAMELIST group containing an allocatable array is incorrect
Date: Thu, 09 Mar 2023 11:57:48 +0000	[thread overview]
Message-ID: <bug-109080-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2023-03-09 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 11:57 urbanjost at comcast dot net [this message]
2023-03-09 18:11 ` [Bug fortran/109080] " anlauf at gcc dot gnu.org
2023-03-10  1:59 ` urbanjost at comcast dot net
2023-03-10  4:16 ` jvdelisle at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109080-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).