drh / lcc

The lcc retargetable ANSI C compiler
https://drh.github.io/lcc/
2k stars 436 forks source link

AddressSanitizer: SEGV on unknown address #46

Open elManto opened 3 years ago

elManto commented 3 years ago

Getting an ASAN SEGV report. To reproduce, I just compiled with asan enabled on x86 machine Linux. To reproduce:

./rcc -target=x86/linux file.c , where file.c the following piece of C code:

int main() { printf("Hello World\n"); return 0; }

Here I attach the full ASAN report

==3559653==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000007ae8e3 bp 0x000000001015 sp 0x7fffffffcf20 T0) ==3559653==The signal is caused by a READ memory access. ==3559653==Hint: this fault was caused by a dereference of a high value address (see register values below). Disassemble the provided pc to learn which register was used.

0 0x7ae8e3 in listnodes /home/elmanto/mnt/output/lcc/src/dag.c:176:35

#1 0x7ade35 in listnodes /home/elmanto/mnt/output/lcc/src/dag.c:333:13
#2 0x7a8f32 in walk /home/elmanto/mnt/output/lcc/src/dag.c:40:2
#3 0x55cfc7 in retcode /home/elmanto/mnt/output/lcc/src/stmt.c:543:2
#4 0x557d46 in statement /home/elmanto/mnt/output/lcc/src/stmt.c
#5 0x4da11c in compound /home/elmanto/mnt/output/lcc/src/decl.c:858:3
#6 0x4d5d35 in funcdefn /home/elmanto/mnt/output/lcc/src/decl.c:769:2
#7 0x4d5d35 in decl /home/elmanto/mnt/output/lcc/src/decl.c:167:5
#8 0x4d0b4a in program /home/elmanto/mnt/output/lcc/src/decl.c:40:4
#9 0x4cd190 in main /home/elmanto/mnt/output/lcc/src/main.c:81:2
#10 0x7ffff7c4f0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#11 0x41d3fd in _start (/home/elmanto/mnt/output/build_lcc/rcc+0x41d3fd)

AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/elmanto/mnt/output/lcc/src/dag.c:176:35 in listnodes ==3559653==ABORTING