From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 257D9385B50F; Fri, 17 Mar 2023 20:40:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 257D9385B50F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679085600; bh=OO3NuPp35+FmxjX+23odfolAoXlahK+9xClMPLntkv0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Jkud1aP9LAgA4MtqeGtnAqS4y3HS5LMxmU19UkqbIi/Tos55ZYB+CpMp/rHv/zQVe KGYbn2zEST0CQyW+vcXYqc4aQxR0dzpUSbeQ5UAdoLWBGbG22zqGg6g/RFgQBL5jma DHQaJ8lqdD+oxOZGuYBFEHflTGk56OsXTu+ATtlU= From: "anlauf at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on everconfirmed bug_status keywords Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109171 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) =3D [(1.,0.), (2.,0.), (3.,0.), (4.,0.)] real, pointer :: p(:) =3D> a(1:3:2)%re real, pointer :: q(:)=20 q =3D> a(1:3:2)%re print *, "size (p) =3D", size (p) print *, "size (q) =3D", size (q) print *, "c_loc(p(1)), c_loc(p(2)) =3D", c_loc(p(1)), c_loc(p(2)) print *, "c_loc(q(1)), c_loc(q(2)) =3D", c_loc(q(1)), c_loc(q(2)) ! print *, p ! this segfaults print *, q end program boom This prints e.g. size (p) =3D 1 size (q) =3D 2 c_loc(p(1)), c_loc(p(2)) =3D 0 0 c_loc(q(1)), c_loc(q(2)) =3D 4202592 4202608 1.00000000 3.00000000=20=20=20=20 Crayftn 14.0 (the only compiler that I found to work here): size (p) =3D 2 size (q) =3D 2 c_loc(p(1)), c_loc(p(2)) =3D 4210816, 4210832 c_loc(q(1)), c_loc(q(2)) =3D 4210816, 4210832 1., 3.=