https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64353

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note the testcase is bogus because xx is clearly loading from global memory and
thus should be pure only.

Of course we should still not ICE here and treat xx as if it were const.

One possibility is to simply never apply IPA SRA to const functions.

Note that we will miscompile things if you change C::i to

void C::i()
{
  x = 1;
  if (xx())
   x = 0;
}

and you add noinline to xx.  sinking will then sink the x = 1 store
to the else arm (because of the bogus const attribute).

Reply via email to