public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not
@ 2023-03-17 9:33 urbanjost at comcast dot net
2023-03-17 9:35 ` [Bug fortran/109171] " urbanjost at comcast dot net
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: urbanjost at comcast dot net @ 2023-03-17 9:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109171
Bug ID: 109171
Summary: initialization using %re causes segfault, as an
assignment does not
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: urbanjost at comcast dot net
Target Milestone: ---
program boom
implicit none
complex, save, target :: a(4)
#ifdef INITIALIZE
real, pointer :: p(:) => a(1:3:2)%re
#else
real, pointer :: p(:)
p => a(1:3:2)%re
#endif
a = [(1., 0.), (2., 0.), (3., 0.), (4., 0)]
print *, p
end program boom
when compiles with "gfortran" and so using the assignment it works; when
compiled with "gfortran -DINITIALIZE" it compiles but gets a segfault on
execution.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/109171] initialization using %re causes segfault, as an assignment does not
2023-03-17 9:33 [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not urbanjost at comcast dot net
@ 2023-03-17 9:35 ` urbanjost at comcast dot net
2023-03-17 20:39 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: urbanjost at comcast dot net @ 2023-03-17 9:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109171
--- Comment #1 from urbanjost at comcast dot net ---
per discussion in
https://groups.google.com/g/comp.lang.fortran/c/zBaOPfeFrOU
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/109171] initialization using %re causes segfault, as an assignment does not
2023-03-17 9:33 [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not 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
2023-03-17 22:41 ` urbanjost at comcast dot net
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-17 20:39 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/109171] initialization using %re causes segfault, as an assignment does not
2023-03-17 9:33 [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not 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
@ 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
4 siblings, 0 replies; 6+ messages in thread
From: urbanjost at comcast dot net @ 2023-03-17 22:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109171
--- Comment #3 from urbanjost at comcast dot net ---
When you said you thought it was a duplicate I spent some time rechecking,
and I think this is covered by 50991? Very different keywords and example,
but if no pointer allocation is working at all, this is just a case of that
more generic issue?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/109171] initialization using %re causes segfault, as an assignment does not
2023-03-17 9:33 [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not urbanjost at comcast dot net
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 6+ messages in thread
From: urbanjost at comcast dot net @ 2023-03-17 22:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109171
--- Comment #4 from urbanjost at comcast dot net ---
Try that again. 101047. Not sure what happened to the paste buffer to get
that other number.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101047
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/109171] initialization using %re causes segfault, as an assignment does not
2023-03-17 9:33 [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not urbanjost at comcast dot net
` (3 preceding siblings ...)
2023-03-17 22:56 ` urbanjost at comcast dot net
@ 2023-03-30 19:16 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-30 19:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109171
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
--- Comment #5 from anlauf at gcc dot gnu.org ---
*** Bug 109348 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-30 19:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 9:33 [Bug fortran/109171] New: initialization using %re causes segfault, as an assignment does not 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
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
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).