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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
struct S { S *p; S *q; S () {} ~S (); };
void bar (S *);

void
foo ()
{
  S a, b;
  bar (nullptr);
  {
    S c;
    c.p = &a;
    c.q = &b;
    bar (&c);
  }
  bar (nullptr);
}

at -O2 gets roughly the same stuff in the IL with taking address of a and b
being done before a and b is clobbered, then c being clobbered, initialized,
eol clobbered and only then a and b destructed and eol clobbered.  But for some
reason no stack sharing happens in that case.

Reply via email to