On Wed, Apr 22, 2020 at 11:24:09AM -0500, Bill Schmidt wrote:
> Hm, but this patch violates the ELFv2 ABI as written.  The ABI includes:
> 
> "Floating-point and vector aggregates that contain padding words and
> integer fields with a width of 0 should not be treated as homogeneous
> aggregates."

struct S {};
struct T : public S { float x, y, z; };
doesn't really contain any padding words nor integer fields with a width of
0, it is laid out as x at offset 0, y at offset sizeof (float) and
z at offset sizeof (float) * 2, the struct has sizeof (T) == sizeof (float) * 3.
The ELFv2 ABI certainly can't talk about how GCC implements them and what
TYPE_FIELDS chain elts should be honored and what should be ignored,
it must talk about what is in the source.
struct S {};
struct U { struct S s; float x, y, z; };
in C is considered homogeneous and is laid out exactly the same, and so is
T in C++14, just in C++17 as an implementation detail the C++ FE adds a base
field.
Short description + the patch that introduced it is
https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01213.html

        Jakub

Reply via email to