Since SSA names do leak into global tree data structures like TYPE_SIZE or in this case GFC_DECL_SAVED_DESCRIPTOR because of frontend bugs we have to be careful to wipe references to the CFG when we deconstruct SSA form because we now do ggc_free that. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-01-19 Richard Biener PR middle-end/98638 * tree-ssanames.c (fini_ssanames): Zero SSA_NAME_DEF_STMT. --- gcc/tree-ssanames.c +++ gcc/tree-ssanames.c @@ -102,6 +102,14 @@ init_ssanames (struct function *fn, int size) void fini_ssanames (struct function *fn) { + unsigned i; + tree name; + /* Some SSA names leak into global tree data structures so we can't simply + ggc_free them. But make sure to clear references to stmts since we now + ggc_free the CFG itself. */ + FOR_EACH_VEC_SAFE_ELT (SSANAMES (fn), i, name) + if (name) + SSA_NAME_DEF_STMT (name) = NULL; vec_free (SSANAMES (fn)); vec_free (FREE_SSANAMES (fn)); vec_free (FREE_SSANAMES_QUEUE (fn));