https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105769
--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #17) > I'm not actually seeing the problematic use of the hoisted address - the > address value itself is stored and the trick of looking at SSA uses defs to > pick up > indirect address uses later doesn't work here as the only use is in the > vector CTOR: > > _15 = (long unsigned int) &bias; > _10 = (long unsigned int) &cov_jn; > _12 = {_10, _15}; > ... > bias ={v} {CLOBBER(bob)}; > > but _12 is only used in > > MEM <vector(2) long unsigned int> [(void *)&D.5715 + 32B] = _12; > > and then maybe indirectly > > __ct_comp (_14, &D.5715.__est); > > I can fix the miscompile with the following patch - we're treating all > CLOBBER kinds as invalidating earlier mentions. I'm not sure that's > really necessary and it's definitely harmful when there are hoisted > address mentions. It also explains that -fstack-reuse=none doesn't > help as the gimplifier only inserts CLOBBER_STORAGE_END clobbers. > I'm also allowing CLOBBER_OBJECT_END here. > > I do not remember whether we discussed doing sth like this instead of the > special SSA use handling we added? > > diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc > index eef565eddb5..92968075b04 100644 > --- a/gcc/cfgexpand.cc > +++ b/gcc/cfgexpand.cc > @@ -632,6 +632,13 @@ add_scope_conflicts_1 (basic_block bb, bitmap work, > bool for_conflict) > that are COMPONENT_REFs. */ > if (!VAR_P (lhs)) > continue; > + tree cl = gimple_assign_rhs1 (stmt); > + /* When the clobber is possibly a object/storage start do not > + ignore previous mentions at this point. Those might > + include hoisted address uses. */ > + if (CLOBBER_KIND (cl) != CLOBBER_STORAGE_END > + && CLOBBER_KIND (cl) != CLOBBER_OBJECT_END) > + continue; > if (DECL_RTL_IF_SET (lhs) == pc_rtx > && (v = decl_to_stack_part->get (lhs))) > bitmap_clear_bit (work, *v); It breaks g++.dg/opt/pr86214-1.C and gcc.target/i386/stack-check-17.c