Segfault in update_last_qword_type
clesmian opened this issue · comments
The attached file compiles cleanly with gcc, but leads to a segfault in c2m.
Input file
typedef struct {
int data[111111111113];
} Boo;
void f (Boo b) {}
int main(){
}
ASAN Output
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2524976==ERROR: AddressSanitizer: SEGV on unknown address 0x7f5fc1592240 (pc 0x55b3f2805b7a bp 0x6160000001d8 sp 0x7f6003df1c70 T1)
==2524976==The signal is caused by a READ memory access.
#0 0x55b3f2805b79 in update_last_qword_type c2mir/x86_64/cx86_64-ABI-code.c:128
#1 0x55b3f280f7c3 in process_aggregate_arg c2mir/x86_64/cx86_64-ABI-code.c:303
#2 0x55b3f284bb29 in target_add_arg_proto c2mir/x86_64/cx86_64-ABI-code.c:361
#3 0x55b3f284bb29 in collect_args_and_func_types c2mir/c2mir.c:10951
#4 0x55b3f28a9e66 in gen c2mir/c2mir.c:12402
#5 0x55b3f28a7465 in gen c2mir/c2mir.c:11628
#6 0x55b3f28a7e4f in gen c2mir/c2mir.c:12489
#7 0x55b3f28c1214 in top_gen c2mir/c2mir.c:10548
#8 0x55b3f28c1214 in gen_mir c2mir/c2mir.c:12878
#9 0x55b3f28c1214 in c2mir_compile c2mir/c2mir.c:13489
#10 0x55b3f28c69b4 in compile c2mir/c2mir-driver.c:498
#11 0x7f60073b1608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
#12 0x7f60072d6132 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f132)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV c2mir/x86_64/cx86_64-ABI-code.c:128 in update_last_qword_type
Thread T1 created by T0 here:
#0 0x7f600755b815 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cc:208
#1 0x55b3f27d8cbb in init_compilers c2mir/c2mir-driver.c:540
#2 0x55b3f27d8cbb in main c2mir/c2mir-driver.c:656
==2524976==ABORTING
I've fixed it by the recent patches.