-fsanitize=undefined behavior

Tom N nospam@codesniffer.com
Fri May 1 17:13:37 GMT 2020

> On May 1, 2020 at 7:39 AM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On Thu, 30 Apr 2020 at 23:58, Tom N <nospam@codesniffer.com> wrote:>> > On April 30, 2020 at 5:57 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote: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> Thanks for the tip. Any reason the description of -fsanitize=undefined doesn't include something like, "If the -fsanitize=undefined option is enabled all sub-options will be enabled unless otherwise specified." so it's clear?Probably because nobody has suggested doing that yet. Would you liketo propose a patch for the docs?
> The relevant place is here:https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/doc/invoke.texi;h=527d362533ab503cee9568b27808177977a52ac8;hb=HEAD#l13541

I'd be happy to but unfortunately I'm not familiar with git. (I know...).  But here's an old-style patch off 8.4 if it helps (attached too):

--- gcc-8.4.0/gcc/doc/invoke.texi	2020-03-04 03:30:00.000000000 -0500
+++ gcc-8.4.0_new/gcc/doc/invoke.texi	2020-05-01 13:10:36.517390533 -0400
@@ -11404,7 +11404,8 @@
 @opindex fsanitize=undefined
 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
 Various computations are instrumented to detect undefined behavior
-at runtime.  Current suboptions are:
+at runtime.  If this option is enabled all sub-options listed below will be
+enabled unless otherwise specified. Current suboptions are:
 @table @gcctabopt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sanitize_undefined_elaboration_gcc8.4.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20200501/a7f88a0c/attachment.bin>

More information about the Gcc-help mailing list