http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52774
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |wrong-code Last reconfirmed| |2012-04-02 CC| |burnus at gcc dot gnu.org, | |pault at gcc dot gnu.org Ever Confirmed|0 |1 Summary|A check is needed to |Derived-type assignment: |prevent deallocation in |check required to prevent |realloc-lhs |double deallocation of | |allocatable component Known to fail| |4.3.4, 4.7.1, 4.8.0 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-02 16:36:17 UTC --- Confirmed. Remarks: a) The reduced program in comment 0 is invalid: As "p1%p" is not allocated, accessing it with print *, p1%p is invalid - and is likely to segfault. Solution: Use print *, allocated (p1%p) which shall print "F"; that still gives the expected segfault or "invalid free()" errors from valgrind with current gfortran - as expected. b) The issue is unrelated to realloc on assignment and seems to be related to allocatable components (TR 15581, a GCC 4.2 feature). At least the program in comment 0 [modified as in comment (a)] also fails with GCC 4.3, using -fno-realloc-lhs does not help, and valgrind shows the same failure.