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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note with -fsanitize=address we get errors as one would expect:

=================================================================
==1==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7dc0b8500030
at pc 0x0000004012de bp 0x7ffdaad9b020 sp 0x7ffdaad9b018
READ of size 8 at 0x7dc0b8500030 thread T0
    #0 0x4012dd in bug(float) (/app/output.s+0x4012dd) (BuildId:
a1b2ef91caf86d8cdb54f9543157d73b050c2ddf)
    #1 0x401456 in main (/app/output.s+0x401456) (BuildId:
a1b2ef91caf86d8cdb54f9543157d73b050c2ddf)
    #2 0x7dc0ba229d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId:
962015aa9d133c6cbcfb31ec300596d7f44d3348)
    #3 0x7dc0ba229e3f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId:
962015aa9d133c6cbcfb31ec300596d7f44d3348)
    #4 0x401114 in _start (/app/output.s+0x401114) (BuildId:
a1b2ef91caf86d8cdb54f9543157d73b050c2ddf)

Address 0x7dc0b8500030 is located in stack of thread T0 at offset 48 in frame
    #0 0x4011e5 in bug(float) (/app/output.s+0x4011e5) (BuildId:
a1b2ef91caf86d8cdb54f9543157d73b050c2ddf)

  This frame has 2 object(s):
    [48, 52) 'y' (line 5) <== Memory access at offset 48 partially overflows
this variable
    [64, 72) 'i' (line 4)
HINT: this may be a false positive if your program uses some custom stack
unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow (/app/output.s+0x4012dd)
(BuildId: a1b2ef91caf86d8cdb54f9543157d73b050c2ddf) in bug(float)
Shadow bytes around the buggy address:
  0x7dc0b84ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b84ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b84ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b84fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b84fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x7dc0b8500000: f1 f1 f1 f1 f1 f1[04]f2 00 f3 f3 f3 00 00 00 00
  0x7dc0b8500080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b8500100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b8500180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b8500200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7dc0b8500280: 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
==1==ABORTING

Reply via email to