[Bug middle-end/70526] [5/6 Regression] GCC 6 miscompiles Firefox JIT compiler

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 2 13:43:00 GMT 2016


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

--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> ---
A fix for your testcase would also be to do

template<typename T>
struct AlignedStorage2
{
  union U
  {
    char mBytes[sizeof(T)];
    uint64_t mDummy;
  } u;
  typedef T _T __attribute__((may_alias));

  const _T* addr() const { return reinterpret_cast<const _T*>(u.mBytes); }
  _T* addr() { return static_cast<_T*>(static_cast<void*>(u.mBytes)); }
};

that is, making sure to return may_alias pointers (and use
AlignedStorage2<>::_T
for temporaries you save addr to and do other accesses).  The stores done
via that type are allowed to be accessed with an effective type of
TypedOrValueRegister.


More information about the Gcc-bugs mailing list