[Bug sanitizer/58841] std::bad_alloc not thrown with -fsanitize=address

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 7 07:41:00 GMT 2017


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                URL|                            |https://github.com/google/s
                   |                            |anitizers/issues/295
         Resolution|---                         |MOVED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, this is a problem in the upstream sanitizer behaviour, not something GCC
can change.

When using ASan I compile with -fcheck-new to avoid crashes in constructors. I
also have a patch to make libstdc++'s std::allocator check for operator new
returning new, and throw a std::bad_alloc instead. That at least makes all code
using std::allocator do the right thing.


More information about the Gcc-bugs mailing list