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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2026-11-12
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |14.5
     Ever confirmed|0                           |1
            Summary|[x86-64 SysV] Struct return |[14/15/16/17 Regression]
                   |loses live data in an array |[x86-64 SysV] Struct return
                   |of padded structs           |loses live data in an array
                   |                            |of padded structs
             Target|x86_64-*-*                  |x86_64-linux
                 CC|                            |liuhongt at gcc dot gnu.org

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed as SysV ABI issue with zero-width bit-fields.

Slightly adapted testcase, fails with every optimization level:

--cut here--
typedef struct
{
  char pad[5];
  struct { char x; int:0; } a[2];
} S;

__attribute__((noipa)) S f (void)
{
  return (S) { .a[1].x = 42 };
}

int main ()
{
  if (f ().a[1].x != 42)
    __builtin_abort ();
  return 0;
}
--cut here--

pr128670.c: In function ‘f’:
pr128670.c:8:1: note: the ABI of passing C structures with zero-width
bit-fields has changed in GCC 12.1

GCC 12.1 started ignoring zero-width bit-fields in C in classify_argument.
Before 12.1, int : 0 happened to mark that eightbyte INTEGER, so the bug is a
regression from 12.1.

A pad of 4 works, while 5, 6 and 7 fail, and replacing int : 0 with explicit
char p[3] works. The “ABI changed in GCC 12.1” -Wpsabi note fires on exactly
the failing cases.

Reply via email to