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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Clang I have (12) reports that as well:

clang-12 pr102769.c -g -fsanitize=address,undefined && ./a.out 
/usr/bin/ld: warning: Cannot export local symbol '__asan_extra_spill_area'
=================================================================
==30045==ERROR: AddressSanitizer: stack-use-after-scope on address
0x7fffffffdcd0 at pc 0x0000004cbe5e bp 0x7fffffffdc30 sp 0x7fffffffdc28
READ of size 4 at 0x7fffffffdcd0 thread T0
    #0 0x4cbe5d in main /home/marxin/Programming/testcases/pr102769.c:5:19
    #1 0x7ffff7cbd53f in __libc_start_call_main
/usr/src/debug/glibc-2.34-2.1.x86_64/csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #2 0x7ffff7cbd5eb in __libc_start_main@GLIBC_2.2.5
/usr/src/debug/glibc-2.34-2.1.x86_64/csu/../csu/libc-start.c:409:3
    #3 0x41f814 in _start
/home/abuild/rpmbuild/BUILD/glibc-2.34/csu/../sysdeps/x86_64/start.S:116

Address 0x7fffffffdcd0 is located in stack of thread T0 at offset 144 in frame
    #0 0x4cbccf in main /home/marxin/Programming/testcases/pr102769.c:2

  This frame has 2 object(s):
    [32, 112) 'g' (line 3)
    [144, 148) 'h' (line 7) <== Memory access at offset 144 is inside this
variable
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-use-after-scope
/home/marxin/Programming/testcases/pr102769.c:5:19 in main
Shadow bytes around the buggy address:
  0x10007fff7b40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7b60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7b70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7b80: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00
=>0x10007fff7b90: 00 00 00 00 00 00 f2 f2 f2 f2[f8]f3 00 00 00 00
  0x10007fff7ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007fff7be0: 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
==30045==ABORTING

Reply via email to