public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Biener	<richard.guenther@gmail.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
	GCC Development <gcc@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Bernd Schmidt <bschmidt@redhat.com>
Subject: Re: Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node
Date: Mon, 17 Oct 2016 15:57:00 -0000	[thread overview]
Message-ID: <87pomz0xzs.fsf@hertz.schwinge.homeip.net> (raw)
In-Reply-To: <CAFiYyc0fqYEfAjJKRpECdznYZVfPsKdVq0Uq6czYBCKbH0u2=w@mail.gmail.com>

Hi!

On Fri, 30 Sep 2016 09:47:56 +0200, Richard Biener <richard.guenther@gmail.com> wrote:
> On Thu, Sep 29, 2016 at 4:48 PM, Thomas Schwinge
> <thomas@codesourcery.com> wrote:
> > On Mon, 19 Sep 2016 13:25:01 +0200, Richard Biener <richard.guenther@gmail.com> wrote:
> >> On Mon, Sep 19, 2016 at 1:19 PM, Thomas Schwinge
> >> <thomas@codesourcery.com> wrote:
> >> > On Mon, 19 Sep 2016 10:18:35 +0200, Richard Biener <richard.guenther@gmail.com> wrote:
> >> >> On Fri, Sep 16, 2016 at 3:32 PM, Thomas Schwinge
> >> >> <thomas@codesourcery.com> wrote:
> >> >> > --- gcc/tree-streamer.c
> >> >> > +++ gcc/tree-streamer.c
> >> >> > @@ -278,9 +278,23 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node)
> >> >> >    streamer_tree_cache_append (cache, node, cache->nodes.length ());
> >> >> >
> >> >> >    if (POINTER_TYPE_P (node)
> >> >> > -      || TREE_CODE (node) == COMPLEX_TYPE
> >> >> >        || TREE_CODE (node) == ARRAY_TYPE)
> >> >> >      record_common_node (cache, TREE_TYPE (node));
> >> >> > +  else if (TREE_CODE (node) == COMPLEX_TYPE)
> >> >> > [...]
> >> >> >    else if (TREE_CODE (node) == RECORD_TYPE)
> >
> >> [looks to me we miss handling of vector type components alltogether,
> >> maybe there are no global vector type trees ...]
> >
> > Looks like it, yes.  Would a patch like the following be reasonable,
> > which explicitly lists/handles all expected tree codes, or is something
> > like that not feasible?  (That's a subset of tree codes I gathered by a
> > partial run of the GCC testsuite, and libgomp testsuite; not claiming
> > this is complete.)
> 
> I think it would be a nice thing to have indeed.
> 
> So -- I'm inclined to approve this patch ;)

After quite a bit of testing (contrib/config-list.mk, modified to run
-fself-test with -flto, to exercise the code I'm modifying), I have now
committed this to trunk in r241246:

commit 29cfc397b0ec2c953ff929d0ba57001c7018ec0c
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Oct 17 15:56:22 2016 +0000

    Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node
    
    	gcc/
    	* tree-streamer.c (record_common_node): Explicitly list expected
    	tree codes.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241246 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog       |  5 +++++
 gcc/tree-streamer.c | 30 +++++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index 86df616..9acc738 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* tree-streamer.c (record_common_node): Explicitly list expected
+	tree codes.
+
 2016-10-17  Richard Biener  <rguenther@suse.de>
 
 	PR tree-optimization/77988
diff --git gcc/tree-streamer.c gcc/tree-streamer.c
index 7ea7096..2139e96 100644
--- gcc/tree-streamer.c
+++ gcc/tree-streamer.c
@@ -277,12 +277,28 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node)
      in the cache as hash value.  */
   streamer_tree_cache_append (cache, node, cache->nodes.length ());
 
-  if (POINTER_TYPE_P (node)
-      || TREE_CODE (node) == COMPLEX_TYPE
-      || TREE_CODE (node) == ARRAY_TYPE)
-    record_common_node (cache, TREE_TYPE (node));
-  else if (TREE_CODE (node) == RECORD_TYPE)
+  switch (TREE_CODE (node))
     {
+    case ERROR_MARK:
+    case FIELD_DECL:
+    case FIXED_POINT_TYPE:
+    case IDENTIFIER_NODE:
+    case INTEGER_CST:
+    case INTEGER_TYPE:
+    case POINTER_BOUNDS_TYPE:
+    case REAL_TYPE:
+    case TREE_LIST:
+    case VOID_CST:
+    case VOID_TYPE:
+      /* No recursive trees.  */
+      break;
+    case ARRAY_TYPE:
+    case COMPLEX_TYPE:
+    case POINTER_TYPE:
+    case REFERENCE_TYPE:
+      record_common_node (cache, TREE_TYPE (node));
+      break;
+    case RECORD_TYPE:
       /* The FIELD_DECLs of structures should be shared, so that every
 	 COMPONENT_REF uses the same tree node when referencing a field.
 	 Pointer equality between FIELD_DECLs is used by the alias
@@ -291,6 +307,10 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node)
 	 nonoverlapping_component_refs_of_decl_p).  */
       for (tree f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f))
 	record_common_node (cache, f);
+      break;
+    default:
+      /* Unexpected tree code.  */
+      gcc_unreachable ();
     }
 }
 


Grüße
 Thomas

  reply	other threads:[~2016-10-17 15:57 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21 12:07 Implement C _FloatN, _FloatNx types Joseph Myers
2016-06-21 15:17 ` FX
2016-06-21 15:38   ` Joseph Myers
2016-06-21 15:21 ` Bill Schmidt
2016-06-21 15:43   ` Joseph Myers
2016-06-21 17:42 ` Implement C _FloatN, _FloatNx types [version 2] Joseph Myers
2016-06-21 20:53   ` Michael Meissner
2016-06-21 21:18     ` Joseph Myers
2016-06-22 20:43   ` Joseph Myers
2016-06-22 21:45     ` FX
2016-06-23 14:20   ` Implement C _FloatN, _FloatNx types [version 3] Joseph Myers
2016-06-27 17:31     ` Ping " Joseph Myers
2016-06-27 21:20       ` Bill Schmidt
2016-06-27 21:24         ` Joseph Myers
2016-06-27 21:38           ` Segher Boessenkool
2016-07-19 13:54       ` Implement C _FloatN, _FloatNx types [version 4] Joseph Myers
2016-07-22 21:59         ` Implement C _FloatN, _FloatNx types [version 5] Joseph Myers
2016-07-29 17:37           ` Ping " Joseph Myers
2016-07-29 22:09             ` Michael Meissner
2016-08-04 23:54             ` Michael Meissner
2016-08-05  0:12               ` Joseph Myers
2016-08-10 11:33             ` Ping^2 " Joseph Myers
2016-08-10 17:14               ` Paul Richard Thomas
2016-08-11  7:05                 ` FX
2016-08-15 22:21               ` Ping^3 " Joseph Myers
2016-08-17 15:43           ` James Greenhalgh
2016-08-17 16:44             ` Joseph Myers
2016-08-17 20:17               ` Implement C _FloatN, _FloatNx types [version 6] Joseph Myers
     [not found]                 ` <CAFiYyc3xqcqJ1rK2X0rC+wwpx3akHbULVG1G47PRmtk4wTk=7A@mail.gmail.com>
2016-08-19 11:06                   ` Joseph Myers
2016-08-19 11:11                     ` Richard Biener
2016-08-19 14:40                       ` Joseph Myers
2016-08-19 15:52                         ` David Malcolm
2016-08-19 16:51                           ` Joseph Myers
2016-08-19 17:21                             ` David Malcolm
2016-09-07 12:18                     ` Advice sought for debugging a lto1 ICE (was: Implement C _FloatN, _FloatNx types [version 6]) Thomas Schwinge
2016-09-07 12:28                       ` Richard Biener
2016-09-08 11:53                         ` Thomas Schwinge
2016-09-14 10:24                           ` Richard Biener
2016-09-16  7:21                           ` [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types (was: Advice sought for debugging a lto1 ICE (was: Implement C _FloatN, _FloatNx types [version 6])) Thomas Schwinge
2016-09-16  9:02                             ` Richard Biener
2016-09-16 14:00                               ` Thomas Schwinge
2016-09-16 18:02                                 ` Joseph Myers
2016-09-19  8:40                                   ` Richard Biener
2016-09-19 11:04                                     ` Thomas Schwinge
2016-09-19 13:22                                       ` Joseph Myers
2016-09-19  8:53                                 ` Richard Biener
2016-09-19 11:57                                   ` Thomas Schwinge
2016-09-19 12:07                                     ` Richard Biener
2016-09-29 13:26                                       ` [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types Thomas Schwinge
2016-10-17 15:59                                         ` Thomas Schwinge
2016-10-19 10:58                                           ` Thomas Schwinge
2016-09-29 14:55                                       ` Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node (was: [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types) Thomas Schwinge
2016-09-30  8:10                                         ` Richard Biener
2016-10-17 15:57                                           ` Thomas Schwinge [this message]
2016-09-16 17:57                               ` [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types (was: Advice sought for debugging a lto1 ICE (was: Implement C _FloatN, _FloatNx types [version 6])) Joseph Myers
2016-08-19 15:28                 ` Implement C _FloatN, _FloatNx types [version 6] Szabolcs Nagy
2016-08-19 16:24                   ` Joseph Myers
2016-08-31 16:58                     ` James Greenhalgh
2016-08-31 17:26                       ` Joseph Myers
2016-09-01 10:52                         ` Szabolcs Nagy
2016-09-01 15:40                           ` Joseph Myers
2016-08-21  9:50                 ` Andreas Schwab
2016-08-22 10:46                   ` Joseph Myers
2016-08-22  8:09                 ` [BUILDROBOT] x86_64: Segmentation fault during -fself-test (was: " Jan-Benedict Glaw
2016-08-22 11:23                   ` Joseph Myers
2016-08-22 10:48                 ` Matthew Wahab
2016-08-22 11:48                   ` Joseph Myers
2016-08-22 17:52                     ` Joseph Myers
2016-09-03 19:46                 ` Andreas Schwab
2016-09-05 11:45                   ` Joseph Myers
2016-09-06  9:02                     ` Richard Biener
2016-09-06 11:18                       ` Joseph Myers
2016-07-19 11:29     ` Implement C _FloatN, _FloatNx types [version 3] James Greenhalgh
2016-07-28 22:43       ` Joseph Myers
2016-08-09 15:26         ` James Greenhalgh
2016-08-09 20:44           ` Joseph Myers
2016-08-05  0:09 ` Implement C _FloatN, _FloatNx types Michael Meissner
2016-08-05  0:35   ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pomz0xzs.fsf@hertz.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).