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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Unless -fsanitize-user-after-scope (default for -fsanitize=address, but not for
-fsanitize=kernel-address), GCC does reuse stack slots.  Just try say:
void foo (int *, int *, int *, int *, int *, int *);

void
bar ()
{
  {
    int a, b, c, d, e, f;
    foo (&a, &b, &c, &d, &e, &f);
  }
  {
    int g, b, c, d, e, f;
    foo (&g, &b, &c, &d, &e, &f);
  }
  {
    int h, b, c, d, e, f;
    foo (&h, &b, &c, &d, &e, &f);
  }
  {
    int i, b, c, d, e, f;
    foo (&i, &b, &c, &d, &e, &f);
  }
  {
    int a, b, c, d, e, f;
    foo (&a, &b, &c, &d, &e, &f);
  }
  {
    int a, b, c, d, e, f;
    foo (&a, &b, &c, &d, &e, &f);
  }
  {
    int a, b, c, d, e, f;
    foo (&a, &b, &c, &d, &e, &f);
  }
  {
    int a, b, c, d, e, f;
    foo (&a, &b, &c, &d, &e, &f);
  }
}

int
baz (int *p)
{
  return *p;
}

Reply via email to