[Bug c++/70690] [6/7 Regression] r235002 miscompiles tcmalloc

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 18 18:25:00 GMT 2016


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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
GCC bug: we're clearing 'cache' during its dynamic initialization even though
default-initialization should have no effect.

struct A {
  A() {}
};

struct APadded : public A {
  char pad[63];
};

int f();
int i = f();
APadded cache[50];
APadded *p = cache;

int f()
{
  cache[0].pad[0] = 42;
  return 1;
}

int main()
{
  if (cache[0].pad[0] != 42)
    __builtin_abort();
}


More information about the Gcc-bugs mailing list