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

            Bug ID: 90570
           Summary: AddressSanitizer: stack-use-after-scope
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mtekieli at gmail dot com
                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: ---

root@marcin:~# cat main.cpp 
#include <vector>

struct stru
{
    std::vector<int> v{1,2,3,4};
    int i{5};
};

int main()
{
    stru s1;
    stru s2;

    return 0;
}
root@marcin:~# g++-9 -fsanitize=address main.cpp -o main          
root@marcin:~# ./main 
=================================================================
==1656==ERROR: AddressSanitizer: stack-use-after-scope on address
0x55fd2cb681c0 at pc 0x7f1c3d1a7b90 bp 0x7fff14bed7c0 sp 0x7fff14becf68

It doesn't matter if vector changed to set or map. Works OK on gcc8.3 and
clang8.

Reply via email to