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

--- Comment #2 from Paweł Bylica <chfast at gmail dot com> ---
Created attachment 49482
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49482&action=edit
Minimal test case source code

It turned out the problem is related to vector's internal instrumentation
_GLIBCXX_SANITIZE_VECTOR.

The minimal test case is the following:

#define _GLIBCXX_SANITIZE_VECTOR 1
#include <vector>

int main()
{
    std::vector<char> v;
    v.reserve(1);

    char in[1] = {};
    v.insert(v.end(), in, in + 1);

    return 0;
}


export ASAN_OPTIONS=detect_invalid_pointer_pairs=1
g++ pointer_subtract_bug.cpp -fsanitize=address,pointer-subtract
./a.out

Reply via email to