[Bug fortran/99359] Unexpected result of the allocation status when the allocatable variable has been deallocated
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 3 14:49:04 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99359
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
No idea – but the code is invalid.
This can also be tested at run time using -fsanitize=address which then shows:
==55724==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000000070
at pc 0x000000405b42 bp 0x7fff0abda0d0 sp 0x7fff0abda0c0
In terms of the Fortran standard, here F2018:
"19.5.2.5 Events that cause the association status of pointers to become
undefined
...
(3) the target of the pointer is deallocated other than through the pointer,
..."
And:
"If the association status of a pointer is disassociated or undefined, the
pointer shall not be referenced or deallocated."
More information about the Gcc-bugs
mailing list