[Bug c++/94050] [10 Regression] C++ ABI change on armv7hl-linux-gnueabi since r10-1302

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 5 17:51:00 GMT 2020


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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
But that happens even before
r10-1302-gc3337b44c40dd1545e00034cb8e1ae1c0dae0fa6.

The actual problem is that in layout_class_type for TenuredCell we see that the
size of TenuredCell and its CLASSTYPE_AS_BASE match, so we set
CLASSTYPE_AS_BASE (t) = t;

But while TYPE_USER_ALIGN of TenuredCell was 0, TYPE_USER_ALIGN of its
CLASSTYPE_AS_BASE was 1.  After we replace it, it's no longer 1.

So then we perform layout_empty_base_or_field for TenuredCell.  Since
TYPE_USER_ALIGN of its CLASSTYPE_AS_BASE is now 0, we don't do this:

  if (CLASSTYPE_USER_ALIGN (type))
    {
      rli->record_align = MAX (rli->record_align, CLASSTYPE_ALIGN (type));
      if (warn_packed)
        rli->unpacked_align = MAX (rli->unpacked_align, CLASSTYPE_ALIGN
(type));
      TYPE_USER_ALIGN (rli->t) = 1;
    }

where rli->t is BaseShape.  And that's how we lose the alignas info on
BaseShape.  Then sizeof thinks its size is 20B and it's not aligned to 24B.

CLASSTYPE_USER_ALIGN is defined as TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE)).


More information about the Gcc-bugs mailing list