Re: -fsanitize=undefined behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Thu, Apr 30, 2020 at 10:57:49PM +0100, Jonathan Wakely via Gcc-help wrote:
> On Thu, 30 Apr 2020 at 22:27, Tom N <nospam@xxxxxxxxxxxxxxx> wrote:
> >
> > The man page for -fsanitize=undefined lists a bunch of sub-options (eg. -fsanitize=shift, -fsanitize=shift-exponent, etc).  If I include -fsanitize=undefined does it enable all of the sub-options, or none, or something in between?  If it doesn't enable all sub-options, is there an easy way to do that short of specifying all of them?
> 
> The man page says:
> 
> "Unlike other similar options, -fsanitize=float-divide-by-zero is not
> enabled by -fsanitize=undefined" and "Unlike other similar options,
> -fsanitize=float-cast-overflow is not enabled by -fsanitize=undefined"
> 
> So it seems reasonable to assume that all the other suboptions are
> enabled by -fsanitize=undefined, and if you want *all* of them then
> use -fsanitize=undefined -fsanitize=float-divide-by-zero
> -fsanitize=float-cast-overflow

The code (flag-types.h) says
  SANITIZE_UNDEFINED_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST
                                  | SANITIZE_BOUNDS_STRICT
(and there are no surprises with how it is used).  The
-fsanitize-bounds-strict option is unusual: it *weakens* what
-fsanitize-bounds does!

So yes, only -fsanitize=float-divide-by-zero and
-fsanitize=float-cast-overflow are not enabled by default.


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux