This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GCC 5.1 and UndefinedBehaviorSanitizer gained a few new sanitization options
- From: Jeffrey Walton <noloader at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 23 Mar 2016 23:53:56 -0400
- Subject: GCC 5.1 and UndefinedBehaviorSanitizer gained a few new sanitization options
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
Hi Everyone,
According to https://gcc.gnu.org/gcc-5/changes.html:
<SNIP>
UndefinedBehaviorSanitizer gained a few new sanitization options:
* -fsanitize=float-divide-by-zero: detect floating-point division by zero;
* -fsanitize=float-cast-overflow: check that the result of
floating-point type to integer conversions do not overflow;
* -fsanitize=bounds: enable instrumentation of array bounds and
detect out-of-bounds accesses;
* -fsanitize=alignment: enable alignment checking, detect various
misaligned objects;
* -fsanitize=object-size: enable object size checking, detect various
out-of-bounds accesses.
* -fsanitize=vptr: enable checking of C++ member function calls,
member accesses and some conversions between pointers to base and
derived classes, detect if the referenced object does not have the
correct dynamic type.
</SNIP>
When using GCC 5.1 or above with -fsanitize=undefined, are these
checks included? Or do they need to be enabled individually? The
reason I ask is bounds checking, alignment checking and object type
violations are clearly UB in C/C++, so I'm thinking they should be
enabled for -fsanitize=undefined.
Thanks in advance.