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.

Reply via email to