[Bug fortran/93925] Invalid memory reference upon call of a routine taking a procedure pointer as argument
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 25 20:04:55 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93925
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
The test case violates, 15.5.2.4 Ordinary dummy variables, subsection 11
of the F2018 standard:
If the dummy argument has the TARGET attribute and the effective argument
does not have the TARGET attribute or is an array section with a vector
subscript, any pointers associated with the dummy argument
become undefined when execution of the procedure completes.
fun returns an undefined pointer, so anything can happen (including
a segfault).
nagfor catches this, by the way:
Runtime Error: 93925.f90, line 36: Reference to dangling pointer P
Target was RETURNed from procedure F
More information about the Gcc-bugs
mailing list