ASan: Avoid emitting redundant return call before report.
AddressSanitizer avoids unnecessary calls before reporting errors, fixing PR126084.
This commit prevents the AddressSanitizer (ASan) from emitting an __asan_handle_no_return call before __asan_report_* calls in certain scenarios. Previously, calls generated during the bitintlower pass were incorrectly instrumented, leading to redundant calls. The fix adjusts how ASan handles these built-in calls and ensures correct type matching for arguments, resolving an issue reported in PR126084.
In Details
The ASan pass instruments memory accesses. Certain __asan_report_* builtins, when lowered from _BitInt types, were previously incorrectly identified as regular calls and instrumented with __asan_handle_no_return_call. This commit modifies asan.cc to prevent instrumentation of BUILT_IN_ASAN_REPORT_* builtins and adjusts builtin initialization (initialize_sanitizer_builtins, asan_expand_poison_ifn) to ensure correct type matching for PTRMODE, resolving PR126084.
- AddressSanitizer (ASan)
- A memory error detector for C/C++ that finds issues like use-after-free and buffer overflows at runtime. It instruments code to add checks around memory operations.
- bitintlower
- A compiler pass that lowers user-defined arbitrary-precision integer types (
_BitInt) into a form the rest of the compiler can handle, often using native machine instructions or standard integer types. - built-in
- A function or operation that is recognized and handled specially by the compiler, often for performance or to interface with runtime libraries like sanitizers.