* -fsanitize=undefined behavior
@ 2020-04-30 20:30 Tom N
2020-04-30 21:57 ` Jonathan Wakely
0 siblings, 1 reply; 8+ messages in thread
From: Tom N @ 2020-04-30 20:30 UTC (permalink / raw)
To: gcc-help
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?
TIA!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-04-30 20:30 -fsanitize=undefined behavior Tom N
@ 2020-04-30 21:57 ` Jonathan Wakely
2020-04-30 22:58 ` Tom N
2020-05-01 13:38 ` Segher Boessenkool
0 siblings, 2 replies; 8+ messages in thread
From: Jonathan Wakely @ 2020-04-30 21:57 UTC (permalink / raw)
To: Tom N; +Cc: gcc-help
On Thu, 30 Apr 2020 at 22:27, Tom N <nospam@codesniffer.com> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-04-30 21:57 ` Jonathan Wakely
@ 2020-04-30 22:58 ` Tom N
2020-05-01 11:39 ` Jonathan Wakely
2020-05-01 13:38 ` Segher Boessenkool
1 sibling, 1 reply; 8+ messages in thread
From: Tom N @ 2020-04-30 22:58 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-help
> 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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-04-30 22:58 ` Tom N
@ 2020-05-01 11:39 ` Jonathan Wakely
2020-05-01 17:13 ` Tom N
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2020-05-01 11:39 UTC (permalink / raw)
To: Tom N; +Cc: gcc-help
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 like
to 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-04-30 21:57 ` Jonathan Wakely
2020-04-30 22:58 ` Tom N
@ 2020-05-01 13:38 ` Segher Boessenkool
1 sibling, 0 replies; 8+ messages in thread
From: Segher Boessenkool @ 2020-05-01 13:38 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: Tom N, gcc-help
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@codesniffer.com> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-05-01 11:39 ` Jonathan Wakely
@ 2020-05-01 17:13 ` Tom N
2020-05-01 18:17 ` Jonathan Wakely
0 siblings, 1 reply; 8+ messages in thread
From: Tom N @ 2020-05-01 17:13 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]
> 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
-----
[-- Attachment #2: sanitize_undefined_elaboration_gcc8.4.patch --]
[-- Type: text/x-patch, Size: 537 bytes --]
--- 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-05-01 17:13 ` Tom N
@ 2020-05-01 18:17 ` Jonathan Wakely
2020-05-01 20:53 ` Tom N
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2020-05-01 18:17 UTC (permalink / raw)
To: Tom N; +Cc: gcc-help
On Fri, 1 May 2020 at 18:13, Tom N <nospam@codesniffer.com> wrote:
>
> > 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):
That'll do, thanks. I'll do the rest early next week.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: -fsanitize=undefined behavior
2020-05-01 18:17 ` Jonathan Wakely
@ 2020-05-01 20:53 ` Tom N
0 siblings, 0 replies; 8+ messages in thread
From: Tom N @ 2020-05-01 20:53 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-help
> On May 1, 2020 at 2:17 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> That'll do, thanks. I'll do the rest early next week.
Thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-05-01 20:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 20:30 -fsanitize=undefined behavior Tom N
2020-04-30 21:57 ` Jonathan Wakely
2020-04-30 22:58 ` Tom N
2020-05-01 11:39 ` Jonathan Wakely
2020-05-01 17:13 ` Tom N
2020-05-01 18:17 ` Jonathan Wakely
2020-05-01 20:53 ` Tom N
2020-05-01 13:38 ` Segher Boessenkool
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).