https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113251
Bug ID: 113251
Summary: [14 Regression] ICE on gcc.dg/asan/pr63845.c on
i686-linux since r14-6946
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at
gcc dot gnu.org
Target Milestone: ---
Since r14-6946-ge66dc37b299cac4171b1c5b90cf6b54388bd5bc5
I'm seeing on i686-linux:
+FAIL: gcc.dg/asan/pr63845.c -O0 (internal compiler error: Segmentation
fault)
+FAIL: gcc.dg/asan/pr63845.c -O0 (test for excess errors)
+FAIL: gcc.dg/asan/pr63845.c -O1 (internal compiler error: Segmentation
fault)
+FAIL: gcc.dg/asan/pr63845.c -O1 (test for excess errors)
+FAIL: gcc.dg/asan/pr63845.c -O2 (internal compiler error: Segmentation
fault)
+FAIL: gcc.dg/asan/pr63845.c -O2 (test for excess errors)
+FAIL: gcc.dg/asan/pr63845.c -O2 -flto (internal compiler error:
Segmentation fault)
+FAIL: gcc.dg/asan/pr63845.c -O2 -flto (test for excess errors)
+FAIL: gcc.dg/asan/pr63845.c -O2 -flto -flto-partition=none (internal
compiler error: Segmentation fault)
+FAIL: gcc.dg/asan/pr63845.c -O2 -flto -flto-partition=none (test for excess
errors)
+FAIL: gcc.dg/asan/pr63845.c -O3 -g (internal compiler error: Segmentation
fault)
+FAIL: gcc.dg/asan/pr63845.c -O3 -g (test for excess errors)
+FAIL: gcc.dg/asan/pr63845.c -Os (internal compiler error: Segmentation
fault)
+FAIL: gcc.dg/asan/pr63845.c -Os (test for excess errors)
(reproduceable also with -fPIC -fsanitize=address -m32 on x86_64-linux).
The ICE is:
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/asan/pr63845.c:16:1: internal compiler
error: Segmentation fault
0x90680da crash_signal
../../gcc/toplev.cc:316
0x90813b8 asan_function_start()
../../gcc/asan.cc:1484
0x944b657 ix86_code_end
../../gcc/config/i386/i386.cc:6334
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
compiler exited with status 1
The problem is when ix86_code_end does
6334 ASM_DECLARE_FUNCTION_NAME (asm_out_file, name, decl);
cfun is still NULL and so when asan_function_start is called,
current_function_funcdef_no access ICEs.
Either varasm.cc could avoid calling asan_function_start if cfun is NULL, or
e.g. ix86_code_end could work it around by temporarily clearing flag_sanitize
around this,
after all, there is no asan support in PIC landing pad.