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

            Bug ID: 97294
           Summary: ASAN "dynamic-stack-buffer-overflow" false positive
                    with OpenMP reduction to std::vector
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paulg-b at web dot de
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Created attachment 49308
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49308&action=edit
Minimal example

When the attached minimal example is compiled with

g++ -fsanitize=address -fopenmp -o asan_omp_test asan_omp_test.cpp

and executed, ASAN reports a dynamic-stack-buffer-overflow. I tested gcc 10.2.1
and 8.2 on different systems (one being the login node of a cluster, the other
being my personal computer with a Fedora 32 OS). 

ASAN seems to report on the copy of the array-section invoked by the omp clause
reduction(+ : ptr[:v.size()])
where ptr is a copy of v.data() and v is the std::vector.

This does *not* happen when the std::vector is replaced by std::array. 

The same code does *not* report anything when compiled and ASAN-instrumented
with clang 10.0.1. I first filed a issue
https://github.com/google/sanitizers/issues/1326 and was sent here.

The problem is also *not* reproducible in C when replacing the std::vector with
dynamic memory allocated via calloc.

Reply via email to