bitintlower: Handle ASAN POISON/POISON_USE with large _BitInt.
Ensures AddressSanitizer poison markers work correctly with large _BitInt types.
This commit addresses an issue where the bitintlower pass did not correctly handle AddressSanitizer’s internal .ASAN_POISON and .ASAN_POISON_USE markers when applied to large or huge _BitInt types. Previously, this led to invalid intermediate representation. The fix integrates the necessary handling for these ASan markers directly into the bitintlower pass, ensuring proper sanitization for _BitInt types and fixing PR126084.
In Details
The bitintlower pass now preprocesses .ASAN_POISON and .ASAN_POISON_USE internal functions when large or huge _BitInt types are involved. This is done early in the pass, similar to how switches are lowered. Previously, these markers, generated by sanopt, would cause invalid IL because bitintlower did not support them for large _BitInt types, leading to incorrect conversions and unexpected ASAN_POISON_USE calls. Changes in asan.cc are also required to correctly report sizes.
- bitintlower
- A GCC pass responsible for lowering the
_BitInt(arbitrary-width integer) types to a representation that can be processed by subsequent compiler stages. - AddressSanitizer (ASan)
- A memory error detector for C/C++ that finds use-after-free, heap buffer overflows, stack buffer overflows, and use-after-return errors. It instruments code to track memory accesses.
- .ASAN_POISON / .ASAN_POISON_USE
- Internal compiler intrinsics or markers used by AddressSanitizer to track memory regions that have been poisoned (e.g., after being freed or going out of scope) and to mark uses of such memory.
- _BitInt
- A non-standard integer type in C and C++ that allows specifying arbitrary bit widths, potentially larger than standard integer types.
- sanopt
- The sanitization optimization pass in GCC, responsible for instrumenting code for sanitizers like ASan.