public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Limix dump_flag enum values range (PR middle-end/86645).
@ 2018-07-24  7:27 Martin Liška
  2018-07-24 14:17 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2018-07-24  7:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

Hi.

That fixes many UBSAN issues that are caused by:

  {"all", dump_flags_t (~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH
			| TDF_STMTADDR | TDF_RHS_ONLY | TDF_NOUID
			| TDF_ENUMERATE_LOCALS | TDF_SCEV | TDF_GIMPLE))},

That goes out of:

      minv = TYPE_MIN_VALUE (TREE_TYPE (type));
      maxv = TYPE_MAX_VALUE (TREE_TYPE (type));

Thus I would like to limit value of "all".

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
And UBSAN errors are gone.

Ready to be installed?
Martin


gcc/ChangeLog:

2018-07-23  Martin Liska  <mliska@suse.cz>

        PR middle-end/86645
	* dumpfile.c: And excluded values with TDF_ALL_VALUES.
	* dumpfile.h (enum dump_flag): Defince TDF_ALL_VALUES.
---
 gcc/dumpfile.c | 7 ++++---
 gcc/dumpfile.h | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)



[-- Attachment #2: 0001-Limix-dump_flag-enum-values-range-PR-middle-end-8664.patch --]
[-- Type: text/x-patch, Size: 1063 bytes --]

diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 6c9920c6bd2..176c9b846d7 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -150,9 +150,10 @@ static const kv_pair<dump_flags_t> dump_options[] =
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
   {"optall", MSG_ALL},
-  {"all", dump_flags_t (~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH
-			| TDF_STMTADDR | TDF_RHS_ONLY | TDF_NOUID
-			| TDF_ENUMERATE_LOCALS | TDF_SCEV | TDF_GIMPLE))},
+  {"all", dump_flags_t (TDF_ALL_VALUES
+			& ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH
+			    | TDF_STMTADDR | TDF_RHS_ONLY | TDF_NOUID
+			    | TDF_ENUMERATE_LOCALS | TDF_SCEV | TDF_GIMPLE))},
   {NULL, TDF_NONE}
 };
 
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index ad14acdfc9a..1dbe3b85b7c 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -146,7 +146,10 @@ enum dump_flag
 	     | MSG_NOTE),
 
   /* Dumping for -fcompare-debug.  */
-  TDF_COMPARE_DEBUG = (1 << 25)
+  TDF_COMPARE_DEBUG = (1 << 25),
+
+  /* All values.  */
+  TDF_ALL_VALUES = (1 << 26) - 1
 };
 
 /* Dump flags type.  */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Limix dump_flag enum values range (PR middle-end/86645).
  2018-07-24  7:27 [PATCH] Limix dump_flag enum values range (PR middle-end/86645) Martin Liška
@ 2018-07-24 14:17 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-07-24 14:17 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jakub Jelinek

On Tue, Jul 24, 2018 at 9:27 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> That fixes many UBSAN issues that are caused by:
>
>   {"all", dump_flags_t (~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_GRAPH
>                         | TDF_STMTADDR | TDF_RHS_ONLY | TDF_NOUID
>                         | TDF_ENUMERATE_LOCALS | TDF_SCEV | TDF_GIMPLE))},
>
> That goes out of:
>
>       minv = TYPE_MIN_VALUE (TREE_TYPE (type));
>       maxv = TYPE_MAX_VALUE (TREE_TYPE (type));
>
> Thus I would like to limit value of "all".
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> And UBSAN errors are gone.
>
> Ready to be installed?

OK.

Richard.

> Martin
>
>
> gcc/ChangeLog:
>
> 2018-07-23  Martin Liska  <mliska@suse.cz>
>
>         PR middle-end/86645
>         * dumpfile.c: And excluded values with TDF_ALL_VALUES.
>         * dumpfile.h (enum dump_flag): Defince TDF_ALL_VALUES.
> ---
>  gcc/dumpfile.c | 7 ++++---
>  gcc/dumpfile.h | 5 ++++-
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-24 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24  7:27 [PATCH] Limix dump_flag enum values range (PR middle-end/86645) Martin Liška
2018-07-24 14:17 ` Richard Biener

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).