[Bug middle-end/126084] ICE verify_gimple failed - _BitInt + ASAN, r14-3751
"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]> Sat, 01 Aug 2026 10:16:49 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126084 --- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:20f76596214b0cef5768bfec8b036947daeb902a commit r15-11440-g20f76596214b0cef5768bfec8b036947daeb902a Author: Jakub Jelinek <[email protected]> Date: Thu Jul 30 09:54:53 2026 +0200 asan: Don't emit __asan_handle_no_return_call before __asan_report_* calls [PR126084] Alex reported that since my r17-2388 fix we now emit an undesirable __asan_handle_no_return call before the __asan_report_{load,store}* calls added during bitintlower pass. Normally (when large/huge _BitInt is not involved), those are added by the sanopt pass which runs after the asan pass and so aren't instrumented. The following patch avoids instrumenting those. Unfortunately the first hunk isn't all that is needed. That is because for the bitintlower added __asan_report_* calls gimple_call_builtin_p (stmt, BUILT_IN_NORMAL) returns false due to argument type mismatch. THe C/C++/Fortran FEs use DEF_PRIMITIVE_TYPE (BT_PTRMODE, (*lang_hooks.types.type_for_mode)(ptr_mode, 0)) and so use signed type with TYPE_MODE (ptr_mode). The fallback initialization in initialize_sanitizer_builtins (done for non-C/C++/Fortran FEs) uses for PTRMODE instead pointer_sized_int_node type, which is initialized to: pointer_sized_int_node = build_nonstandard_integer_type (POINTER_SIZE, 1); where ptr_mode = as_a <scalar_int_mode> (mode_for_size (POINTER_SIZE, GET_MODE_CLASS (Pmode), 0).require ()); so, I think both have the same precision, just one is signed and one unsigned. And then asan_expand_poison_ifn uses pointer_sized_int_node. The following patch just changes initialize_sanitizer_builtins and asan_expand_poison_ifn to do the same thing as the C/C++/Fortran FEs here. Seems asan.cc is full of similar builtin argument type mismatches, but I've changed only what was needed for this patch. 2026-07-30 Jakub Jelinek <[email protected]> PR middle-end/126084 * asan.cc (maybe_instrument_call): Don't instrument BUILT_IN_ASAN_REPORT_{LOAD,STORE}{1,2,4,8,16,_N} builtins. (initialize_sanitizer_builtins): Use (*lang_hooks.types.type_for_mode) (ptr_mode, 0) instead of pointer_sized_int_mode for PTRMODE arguments. (asan_expand_poison_ifn): Likewise. Reviewed-by: Richard Biener <[email protected]> (cherry picked from commit 2720a372bda550b8516a786562e0f5b705aede5b)