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

--- Comment #10 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Hmmm, the other issue is this:

g++ -g -O2 -fsanitize=undefined  object-size-9.c
./a.out
object-size-9.c:21:11: runtime error: load of address 0x7fffaad34acc with
insufficient space for an object of type 'char'
0x7fffaad34acc: note: pointer points here
  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  c5 1e c8 b1 fa 7f 00 00  00
00 00 00 00 00 00 00
              ^ 
object-size-9.c:34:8: runtime error: index 12 out of bounds for type 'char [8]'
object-size-9.c:34:15: runtime error: store to address 0x7fffaad34abc with
insufficient space for an object of type 'char'
0x7fffaad34abc: note: pointer points here
  01 00 00 00 00 00 00 00  61 62 63 64 65 66 67 00  01 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
              ^ 
object-size-9.c:50:11: runtime error: store to address 0x7fffaad34abc with
insufficient space for an object of type 'char'
0x7fffaad34abc: note: pointer points here
  01 00 00 00 7a 00 00 00  61 62 63 64 65 66 67 00  01 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
              ^ 
object-size-9.c:64:15: runtime error: index 12 out of bounds for type 'U [10]'
object-size-9.c:64:17: runtime error: load of address 0x000000601790 with
insufficient space for an object of type 'unsigned int'
0x000000601790: 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
              ^ 
object-size-9.c:78:13: runtime error: load of address 0x000000601790 with
insufficient space for an object of type 'unsigned int'
0x000000601790: 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
              ^ 



BUT:

g++ -g -O2 -fsanitize=undefined -fpic object-size-9.c
./a.out
object-size-9.c:21:11: runtime error: load of address 0x7ffc0615bf6c with
insufficient space for an object of type 'char'
0x7ffc0615bf6c: note: pointer points here
  01 00 00 00 00 00 00 00  35 53 6d d0 c4 7f 00 00  00 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
              ^ 
object-size-9.c:34:8: runtime error: index 12 out of bounds for type 'char [8]'
object-size-9.c:64:15: runtime error: index 12 out of bounds for type 'U [10]'
object-size-9.c:64:17: runtime error: load of address 0x0000006015f0 with
insufficient space for an object of type 'unsigned int'
0x0000006015f0: 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
              ^ 
object-size-9.c:78:13: runtime error: load of address 0x0000006015f0 with
insufficient space for an object of type 'unsigned int'
0x0000006015f0: 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
              ^ 



... So with -fpic the following two messages are completely missing:

object-size-9.c:34:15: runtime error: store to address 0x7ffc0973608c with
insufficient space for an object of type 'char'
0x7ffc0973608c: note: pointer points here
  01 00 00 00 00 00 00 00  61 62 63 64 65 66 67 00  01 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
              ^ 
object-size-9.c:50:11: runtime error: store to address 0x7ffc0973608c with
insufficient space for an object of type 'char'
0x7ffc0973608c: note: pointer points here
  01 00 00 00 7a 00 00 00  61 62 63 64 65 66 67 00  01 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
              ^

Reply via email to