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

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 18 08:35:00 GMT 2016


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think the new GCC is correct here and the old one accidentally just got it
"right".
We have:
CentralFreeListPadded Static::central_cache_[kNumClasses];


Which is of type:
class CentralFreeListPadded : public CentralFreeListPaddedTo<
  sizeof(CentralFreeList) % 64>

CentralFreeListPaddedTo  is defined as either:
class CentralFreeListPaddedTo : public CentralFreeList

or
class CentralFreeListPaddedTo<0> : public CentralFreeList

CentralFreeList has the following constructor:
  CentralFreeList() : lock_(base::LINKER_INITIALIZED) { }


So it just happened that LINKER_INITIALIZED was also zero:
namespace base {
enum LinkerInitialized { LINKER_INITIALIZED };
}


So this is a bug in tcmalloc as far as I can tell.

Before the call to the constructor was not done but after it is done.


More information about the Gcc-bugs mailing list