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

            Bug ID: 89868
           Summary: -fsanitize=address inhibits C++ unhandled exception
                    core dump
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Hi!

Noticed that -fsanitize=address appears to inhibit core dump from C++
exceptions. Is there a way to still get the core dump?

The address sanitizer does not catch unhandled C++ exceptions and show a
backtrace etc, but it does cause the core to not be dumped.


Regular compile without Address Sanitizer:
$ g++-8 -Wall -o exception exception.cpp

$ ./exception
terminate called after throwing an instance of 'std::out_of_range'
   what():  vector::_M_range_check: __n (which is 0) >= this->size() 
(which is 0)
Aborted (core dumped)
$


#include <vector>
int main()
{
      std::vector<int> v;
      return v.at(0);
}


With sanitizer:

$ g++-8 -fsanitize=address -Wall -o exception exception.cpp
$ ./exception 
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is
0)
Aborted
$

Reply via email to