middle-end/98638 - avoid SSA reference to stmts after SSA deconstruction

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.

2021-01-19  Richard Biener  <rguenther@suse.de>

	PR middle-end/98638
	* tree-ssanames.c (fini_ssanames): Zero SSA_NAME_DEF_STMT.
This commit is contained in:
Richard Biener 2021-01-19 13:40:39 +01:00
parent 4b690f161b
commit f27cd6f422

View file

@ -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));