https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125072

--- Comment #4 from Wismill <dev at wismill dot eu> ---
Created attachment 64527
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64527&action=edit
Another reproducer on load instead of store

Another reproducer similar to comment #2, but which fails on load instead of
store:

$ gcc-16 -Wall bug-counted_by-load-ubsan.c && ./a.out
y.a = 0x404018
y.a + 1 = 0x40401c
&y.a[1] = 0x40401c
y.c[0] = 1
y.c[1] = 2

$ gcc-16 -Wall -fsanitize=undefined bug-counted_by-load-ubsan.c && ./a.out
y.a = 0x404180
y.a + 1 = 0x404181
&y.a[1] = 0x404181
y.c[0] = 1
bug-counted_by-ubsan.c:18:3: runtime error: load of misaligned address
0x000000404181 for type 'int', which requires 4 byte alignment
0x000000404181: note: pointer points here
 00 00 00  01 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00
00 00  00 00 00 00 00
              ^ 
y.c[1] = 33554432

Reply via email to