https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111685
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With -fsanitize=address we get this at runtime:
```
=================================================================
==1==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fc69190003c
at pc 0x000000402d20 bp 0x7ffdf89976f0 sp 0x7ffdf89976e8
READ of size 4 at 0x7fc69190003c thread T0
#0 0x402d1f in void std::__unguarded_linear_insert<int*,
__gnu_cxx::__ops::_Val_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}> >(int*,
__gnu_cxx::__ops::_Val_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}>)
(/app/output.s+0x402d1f) (BuildId: 644c16636015edebcd5c5ddf005f8c7778b15662)
#1 0x40222f in void std::__insertion_sort<int*,
__gnu_cxx::__ops::_Iter_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}> >(int*,
int*, __gnu_cxx::__ops::_Iter_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}>)
(/app/output.s+0x40222f) (BuildId: 644c16636015edebcd5c5ddf005f8c7778b15662)
#2 0x401c23 in void std::__final_insertion_sort<int*,
__gnu_cxx::__ops::_Iter_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}> >(int*,
int*, __gnu_cxx::__ops::_Iter_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}>)
(/app/output.s+0x401c23) (BuildId: 644c16636015edebcd5c5ddf005f8c7778b15662)
#3 0x401875 in void std::__sort<int*,
__gnu_cxx::__ops::_Iter_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}> >(int*,
int*, __gnu_cxx::__ops::_Iter_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}>)
(/app/output.s+0x401875) (BuildId: 644c16636015edebcd5c5ddf005f8c7778b15662)
#4 0x401653 in void std::sort<int*, main::{lambda(auto:1&&,
auto:2&&)#1}>(int*, int*, main::{lambda(auto:1&&, auto:2&&)#1})
(/app/output.s+0x401653) (BuildId: 644c16636015edebcd5c5ddf005f8c7778b15662)
#5 0x401506 in main (/app/output.s+0x401506) (BuildId:
644c16636015edebcd5c5ddf005f8c7778b15662)
#6 0x7fc693b93082 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId:
1878e6b475720c7c51969e69ab2d276fae6d1dee)
#7 0x40122d in _start (/app/output.s+0x40122d) (BuildId:
644c16636015edebcd5c5ddf005f8c7778b15662)
Address 0x7fc69190003c is located in stack of thread T0 at offset 60 in frame
#0 0x4012f5 in main (/app/output.s+0x4012f5) (BuildId:
644c16636015edebcd5c5ddf005f8c7778b15662)
This frame has 5 object(s):
[32, 33) '<unknown>'
[48, 49) 'cmp' (line 13)
[64, 76) 'anums' (line 10) <== Memory access at offset 60 underflows this
variable
[96, 108) 'nums' (line 11)
[128, 152) 'vnums' (line 9)
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+0x402d1f)
(BuildId: 644c16636015edebcd5c5ddf005f8c7778b15662) in void
std::__unguarded_linear_insert<int*,
__gnu_cxx::__ops::_Val_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}> >(int*,
__gnu_cxx::__ops::_Val_comp_iter<main::{lambda(auto:1&&, auto:2&&)#1}>)
Shadow bytes around the buggy address:
0x7fc6918ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc6918ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc6918ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc6918fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc6918fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x7fc691900000: f1 f1 f1 f1 f8 f2 01[f2]00 04 f2 f2 00 04 f2 f2
0x7fc691900080: 00 00 00 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00
0x7fc691900100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc691900180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc691900200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7fc691900280: 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
```