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

--- Comment #5 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jonathan Wakely from comment #3)
> Fixed on trunk so far, but this is backportable.

#include<vector>

int main()
{
        std::vector<std::size_t> vec;
        vec.reserve(20);
        vec[3]=40;
}

clang++ -o vec vec.cc -Ofast -std=c++2b -fuse-ld=lld
-fsanitize=address,undefined

Nothing.

clang++ -o vec vec.cc -Ofast -std=c++2b -I../../include -fuse-ld=lld
-fsanitize=address,undefined -D_GLIBCXX_SANITIZE_STD_ALLOCATOR
-D_GLIBCXX_SANITIZE_VECTOR

=================================================================
==15804==ERROR: AddressSanitizer: container-overflow on address 0x01e922536bd8
at pc 0x7ff6596d16df bp 0x0001000ff700 sp 0x0001000ff748
WRITE of size 8 at 0x01e922536bd8 thread T0
    #0 0x7ff6596d16de in main
(D:\hg\fast_io\examples\0007.legacy\vec.exe+0x1400016de)
    #1 0x7ff6596d13b0 in __tmainCRTStartup
/home/cqwrteur/myhome/gcc_build/canadian/x86_64-w64-mingw32/mingw-w64/mingw-w64-crt/../../../../../mingw-w64/mingw-w64-crt/crt/crtexe.c:321:15
    #2 0x7ff6596d14e5 in mainCRTStartup
/home/cqwrteur/myhome/gcc_build/canadian/x86_64-w64-mingw32/mingw-w64/mingw-w64-crt/../../../../../mingw-w64/mingw-w64-crt/crt/crtexe.c:202:9
    #3 0x7ffc57577033  (C:\WINDOWS\System32\KERNEL32.DLL+0x180017033)
    #4 0x7ffc58fe2650  (C:\WINDOWS\SYSTEM32\ntdll.dll+0x180052650)

Reply via email to