diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2024-05-12 15:16:23 +0200 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2024-05-20 22:43:26 +0200 |
commit | 38d1761c0c94b77a081ccc180d6e039f7a670468 (patch) | |
tree | f869a415a9eb3842208c00a5ed09f2111b88cb21 /gcc/tree-ssa-phiopt.cc | |
parent | a2e4fe5a53cf75cd055f64e745ebd51253e42254 (diff) | |
download | gcc-38d1761c0c94b77a081ccc180d6e039f7a670468.zip gcc-38d1761c0c94b77a081ccc180d6e039f7a670468.tar.gz gcc-38d1761c0c94b77a081ccc180d6e039f7a670468.tar.bz2 |
fortran: Assume there is no cyclic reference with submodule symbols [PR99798]
This prevents a premature release of memory with procedure symbols from
submodules, causing random compiler crashes.
The problem is a fragile detection of cyclic references, which can match
with procedures host-associated from a module in submodules, in cases where it
shouldn't. The formal namespace is released, and with it the dummy arguments
symbols of the procedure. But there is no cyclic reference, so the procedure
symbol itself is not released and remains, with pointers to its dummy arguments
now dangling.
The fix adds a condition to avoid the case, and refactors to a new predicate
by the way. Part of the original condition is also removed, for lack of a
reason to keep it.
PR fortran/99798
gcc/fortran/ChangeLog:
* symbol.cc (gfc_release_symbol): Move the condition guarding
the handling cyclic references...
(cyclic_reference_break_needed): ... here as a new predicate.
Remove superfluous parts. Add a condition preventing any premature
release with submodule symbols.
gcc/testsuite/ChangeLog:
* gfortran.dg/submodule_33.f08: New test.
Diffstat (limited to 'gcc/tree-ssa-phiopt.cc')
0 files changed, 0 insertions, 0 deletions