Fix mangling for __builtin_bswapg and __builtin_bitreverseg calls.
Corrects the mangling of calls to `__builtin_bswapg` and `__builtin_bitreverseg` which previously caused ICEs.
This commit fixes an Internal Compiler Error (ICE) during name mangling for calls to __builtin_bswapg and __builtin_bitreverseg. These built-in functions, which have return types dependent on their argument types, were treated as internal function calls (IFN_BSWAP, IFN_BITREVERSE). The compiler previously crashed when trying to mangle these calls. The fix ensures they are mangled similarly to type-generic built-ins with fixed return types, resolving the ICE.
In Details
Fixes an ICE in write_expression during mangling when encountering calls to IFN_BSWAP and IFN_BITREVERSE. These are treated as internal function calls for type-generic built-ins (__builtin_popcountg is an example) where the return type depends on the argument type. The current mangling logic in write_expression incorrectly handles calls to IFN_* functions when type_dependent_expression_p_push is true, leading to an ICE. The patch mangles these calls similar to how it handles type-generic built-ins with dependent expressions.
- name mangling
- The process by which C++ compilers encode function and variable names, including information about their namespaces, classes, and argument types, into unique symbol names used by the linker.
- ICE
- Internal Compiler Error. An unexpected condition encountered by the compiler during translation that prevents it from continuing compilation.
- __builtin_bswapg
- A GCC built-in function that performs a byte swap operation. The 'g' suffix suggests it might be a generic or template-based version.
- __builtin_bitreverseg
- A GCC built-in function that reverses the bits of its argument. The 'g' suffix likely indicates a generic or template-based implementation.
- type-generic builtins
- Built-in functions whose behavior or return type can vary based on the type of their arguments, often implemented using templates or similar mechanisms.
- CALL_EXPR
- An internal GCC expression code representing a function call.