public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109171] initialization using %re causes segfault, as an assignment does not Date: Fri, 17 Mar 2023 20:39:59 +0000 [thread overview] Message-ID: <bug-109171-4-j6fh6Ajw6q@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109171-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109171 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-03-17 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Keywords| |wrong-code --- Comment #2 from anlauf at gcc dot gnu.org --- Confirmed. I also have the gut feeling that there is a duplicate. It appears that we do not initialize the pointer. Consider: program boom use, intrinsic :: iso_c_binding, only: c_loc implicit none complex, save, target :: a(4) = [(1.,0.), (2.,0.), (3.,0.), (4.,0.)] real, pointer :: p(:) => a(1:3:2)%re real, pointer :: q(:) q => a(1:3:2)%re print *, "size (p) =", size (p) print *, "size (q) =", size (q) print *, "c_loc(p(1)), c_loc(p(2)) =", c_loc(p(1)), c_loc(p(2)) print *, "c_loc(q(1)), c_loc(q(2)) =", c_loc(q(1)), c_loc(q(2)) ! print *, p ! this segfaults print *, q end program boom This prints e.g. size (p) = 1 size (q) = 2 c_loc(p(1)), c_loc(p(2)) = 0 0 c_loc(q(1)), c_loc(q(2)) = 4202592 4202608 1.00000000 3.00000000 Crayftn 14.0 (the only compiler that I found to work here): size (p) = 2 size (q) = 2 c_loc(p(1)), c_loc(p(2)) = 4210816, 4210832 c_loc(q(1)), c_loc(q(2)) = 4210816, 4210832 1., 3.
next prev parent reply other threads:[~2023-03-17 20:40 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-17 9:33 [Bug fortran/109171] New: " urbanjost at comcast dot net 2023-03-17 9:35 ` [Bug fortran/109171] " urbanjost at comcast dot net 2023-03-17 20:39 ` anlauf at gcc dot gnu.org [this message] 2023-03-17 22:41 ` urbanjost at comcast dot net 2023-03-17 22:56 ` urbanjost at comcast dot net 2023-03-30 19:16 ` anlauf 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-109171-4-j6fh6Ajw6q@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: linkBe 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).