GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
i386

i386: Pass aggregates with unaligned members in memory per PSABI.

i386 ABI compliance improved for passing structs with unaligned members.

This commit addresses a violation of the PSABI (Procedure Call Standard Application Binary Interface) on i386 concerning the passing and returning of aggregate types containing unaligned members. Previously, classify_argument did not correctly identify structures with bit-fields or _BitInt(N) members at misaligned offsets as requiring memory passing. A new misaligned_member_p function and related checks ensure that such aggregates are classified as MEMORY, aligning with the PSABI specification and improving ABI compliance.

In Details

The classify_argument function on i386 has been updated to correctly handle aggregates containing unaligned members, particularly packed structs and unions, as per PSABI 3.2.3. The function previously misclassified structs whose members were solely bit-fields or _BitInt(N) types (N>32) at misaligned offsets, leading them to be passed in registers instead of memory. A new helper misaligned_member_p checks the offset against the type's natural alignment, and its results are used to classify such members as MEMORY. The -Wpsabi warning is now more precise with the addition of `PSABI_UNA…

For Context
i386
The 32-bit Intel x86 instruction set architecture.
aggregate type
A composite data type that groups together other data types, such as structures (structs) and unions.
unaligned member
A member within an aggregate type that is not stored at an address that is a multiple of its natural alignment requirement.
PSABI
Procedure Call Standard Application Binary Interface. Defines conventions for function calls, including how arguments are passed and return values handled.
classify_argument
An internal GCC function that determines how function arguments should be passed (e.g., in registers or memory) based on their type and target ABI.
_BitInt(N)
A GCC extension for representing integers of arbitrary bit width N.
Filed Under: i386abiperformance