https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87881
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 45257 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45257&action=edit gcc9-pr87881.patch Untested fix. simplify_const_ref is similar, but actually iterates p->ref and thus properly stops immediately after handling the REF_INQUIRY, returning true, because it has no further refs. simplify_ref_chain is weird in that it is passed two arguments, one ref and one p, where in all callers do pass p->ref and &p to those arguments, so if for REF_INQUIRY we replace *p with something different, all the references are freed and we need to stop iterating.