aarch64 fixes ICE related to function argument alignment with may_alias
Resolution for an ICE on aarch64 when handling function argument alignment with `may_alias` attribute.
A compiler ice (Internal Compiler Error) on the aarch64 backend, related to function argument alignment when the may_alias attribute is used, has been fixed. The issue occurred because the compiler incorrectly retained user-specified alignment on types that were their own main variant due to may_alias. The fix ensures that user alignment is ignored, and the natural mode alignment is used, aligning behavior with AAPCS64 and Clang.
In Details
Fixes an AArch64 ICE in aarch64_function_arg_alignment (PR124146). The ICE arose when may_alias caused a type's TYPE_MAIN_VARIANT to retain user alignment, violating the gcc_assert (!TYPE_USER_ALIGN (type)). The fix modifies the function to explicitly ignore user alignment when present on the main variant, falling back to the mode's natural alignment, consistent with AAPCS64 and Clang. This also correctly handles _BitInt types.
- aarch64
- The 64-bit ARM architecture, commonly used in mobile devices and servers.
- ICE
- Internal Compiler Error. A severe error reported by the compiler itself, usually indicating a bug in the compiler's internal logic.
- may_alias
- A C/C++ type attribute that tells the compiler that pointers of this type may alias with pointers of other types, affecting optimization decisions.
- alignment
- The requirement that data be stored in memory at an address that is a multiple of its size, important for performance and correctness on many architectures.
- AAPCS64
- The ARM Architecture Procedure Call Standard for 64-bit state. It defines conventions for function calls, including argument passing and return values.