gimple: Fix ICE on ENUMERAL_TYPE with large/huge _BitInt underlying type during LTO
Fixes a compiler crash during LTO when handling ENUMERAL_TYPE with large _BitInt underlying types.
This commit resolves an internal compiler error (ICE) that occurred during Link-Time Optimization (LTO) when processing enumeration types (ENUMERAL_TYPE) that use large or huge _BitInt as their underlying type. The gimple_get_alias_set function, which was trying to determine the type size, failed for these large bit-integers, leading to the ICE. The fix ensures that the alias set is correctly determined by using the underlying _BitInt type directly.
In Details
The gimple_get_alias_set function incorrectly calls type_for_size on the size of ENUMERAL_TYPEs. When the underlying type is a large _BitInt (e.g., _BitInt(1000)), type_for_size may return NULL_TREE. Subsequently, calling get_alias_set on NULL_TREE results in an ICE. This change modifies gimple_get_alias_set to use the underlying BITINT_TYPE directly when processing ENUMERAL_TYPEs with such large underlying types.
- gimple
- GCC's internal three-address intermediate representation. It's a lower-level representation than GENERIC but higher-level than RTL.
- LTO
- Link-Time Optimization, a compiler optimization technique where the compiler performs optimizations across multiple translation units during the linking stage, rather than just within a single file.
- ICE
- Internal Compiler Error, a condition where the compiler encounters an unrecoverable internal fault and terminates.
- ENUMERAL_TYPE
- GCC's internal representation for enumeration types (enum).
- _BitInt
- A C++ extension that provides support for arbitrary-width integers.
- NULL_TREE
- GCC's internal representation for a null or invalid tree node.
- alias set
- A concept used in optimization to group memory locations that may potentially alias (refer to the same memory) to help the compiler reason about memory accesses.