https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95602
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marxin at gcc dot gnu.org Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- It's an invalid code: $ gcc pr95602.c -fsanitize=address && ./a.out pr95602.c:9:16: warning: initialization of ‘__int128 *’ from incompatible pointer type ‘int *’ [-Wincompatible-pointer-types] 9 | __int128 *mc = &tq.oj; | ^ ================================================================= ==25529==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000404264 at pc 0x0000004013f3 bp 0x7fffffffe070 sp 0x7fffffffe068 READ of size 16 at 0x000000404264 thread T0 #0 0x4013f2 in r8 (/home/marxin/Programming/testcases/a.out+0x4013f2) #1 0x4015ee in main (/home/marxin/Programming/testcases/a.out+0x4015ee) #2 0x7ffff741acc9 in __libc_start_main ../csu/libc-start.c:308 #3 0x4010c9 in _start (/home/marxin/Programming/testcases/a.out+0x4010c9) 0x000000404268 is located 0 bytes to the right of global variable 'tq' defined in 'pr95602.c:6:11' (0x404260) of size 8 0x000000404264 is located 60 bytes to the left of global variable 'sn' defined in 'pr95602.c:7:5' (0x4042a0) of size 4 SUMMARY: AddressSanitizer: global-buffer-overflow (/home/marxin/Programming/testcases/a.out+0x4013f2) in r8 Shadow bytes around the buggy address: 0x0000800787f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078810: 00 00 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x000080078820: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 f9 0x000080078830: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 =>0x000080078840: f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00[00]f9 f9 f9 0x000080078850: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 0x000080078860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==25529==ABORTING $ gcc pr95602.c -fsanitize=undefined && ./a.out pr95602.c:9:16: warning: initialization of ‘__int128 *’ from incompatible pointer type ‘int *’ [-Wincompatible-pointer-types] 9 | __int128 *mc = &tq.oj; | ^ pr95602.c:36:12: runtime error: load of misaligned address 0x000000404104 for type '__int128', which requires 16 byte alignment 0x000000404104: note: pointer points here 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ Segmentation fault (core dumped)