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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 66189
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66189&action=edit
Patch that ignores zero-length array members in arg classification.

A zero-length array member occupies no storage and should contribute
NO_CLASS, like an empty structure or union and like the flexible array
member handled for PR39545.  Currently classify_argument classifies the
member by its element type when the array is at a nonzero offset within
an eightbyte.  As a result struct { float x; int a[0]; } is returned in
%eax instead of %xmm0, and the same happens for a union with a
zero-length array member at such an offset, which disagrees with clang.

Skip such members in both the RECORD_TYPE and UNION_TYPE loops, and emit
a -Wpsabi note about the ABI change.  At offset 0 of an eightbyte the
array was already classified as NO_CLASS, so the note is only emitted
for members at a nonzero offset.

Assisted-by: Claude Sonnet 5.5

Reply via email to