public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Joseph Myers	<joseph@codesourcery.com>,
	GCC Development <gcc@gcc.gnu.org>,
	Jakub Jelinek	<jakub@redhat.com>,
	Bernd Schmidt <bschmidt@redhat.com>
Subject: Re: [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]))
Date: Mon, 19 Sep 2016 11:57:00 -0000	[thread overview]
Message-ID: <87bmzkb0h5.fsf@hertz.schwinge.homeip.net> (raw)
In-Reply-To: <CAFiYyc0ik7JkzvnWMyztNm=8UPhivrj-aRffT0vCUCV1qxoaHQ@mail.gmail.com>

Hi!

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-core.h
> > +++ gcc/tree-core.h
> > @@ -553,20 +553,6 @@ enum tree_index {
> >    TI_BOOLEAN_FALSE,
> >    TI_BOOLEAN_TRUE,
> >
> > -  TI_COMPLEX_INTEGER_TYPE,
> > -[...]
> > -  TI_COMPLEX_FLOAT128X_TYPE,
> > -
> >    TI_FLOAT_TYPE,
> >    TI_DOUBLE_TYPE,
> >    TI_LONG_DOUBLE_TYPE,
> > @@ -596,6 +582,23 @@ enum tree_index {
> >                              - TI_FLOATN_NX_TYPE_FIRST          \
> >                              + 1)
> >
> > +  /* Put the complex types after their component types, so that in (sequential)
> > +     tree streaming we can assert that their component types have already been
> > +     handled (see tree-streamer.c:record_common_node).  */
> > +  TI_COMPLEX_INTEGER_TYPE,
> > +  TI_COMPLEX_FLOAT_TYPE,
> > +  TI_COMPLEX_DOUBLE_TYPE,
> > +  TI_COMPLEX_LONG_DOUBLE_TYPE,
> > +
> > +  TI_COMPLEX_FLOAT16_TYPE,
> > +  TI_COMPLEX_FLOATN_NX_TYPE_FIRST = TI_COMPLEX_FLOAT16_TYPE,
> > +  TI_COMPLEX_FLOAT32_TYPE,
> > +  TI_COMPLEX_FLOAT64_TYPE,
> > +  TI_COMPLEX_FLOAT128_TYPE,
> > +  TI_COMPLEX_FLOAT32X_TYPE,
> > +  TI_COMPLEX_FLOAT64X_TYPE,
> > +  TI_COMPLEX_FLOAT128X_TYPE,
> > +
> >    TI_FLOAT_PTR_TYPE,
> >    TI_DOUBLE_PTR_TYPE,
> >    TI_LONG_DOUBLE_PTR_TYPE,
> 
> If the above change alone fixes your issues then it is fine to commit.

That alone won't fix the problem, because we'd still have the recursion
in gcc/tree-streamer.c:record_common_node done differently for x86_64
target and nvptx offload target.

> > --- 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)
> > +    {
> > +      /* Assert that complex types' component types have already been handled
> > +        (and we thus don't need to recurse here).  See PR lto/77458.  */
> > +      if (cache->node_map)
> > +       gcc_assert (streamer_tree_cache_lookup (cache, TREE_TYPE (node), NULL));
> > +      else
> > +       {
> > +         gcc_assert (cache->nodes.exists ());
> > +         bool found = false;
> > +         for (unsigned i = 0; !found && i < cache->nodes.length (); ++i)
> > +           found = true;
> 
> hmm, this doesn't actually test anything? ;)

;-) Haha, hooray for patch review!

> > +         gcc_assert (found);
> > +       }
> > +    }
> >    else if (TREE_CODE (node) == RECORD_TYPE)
> >      {
> >        /* The FIELD_DECLs of structures should be shared, so that every

> So I very much like to go forward with this kind of change as well

OK, good.  So, in plain text, we'll make it a requirement that:
integer_types trees must only refer to earlier integer_types trees;
sizetype_tab trees must only refer to integer_types trees, and earlier
sizetype_tab trees; and global_trees must only refer to integer_types
trees, sizetype_tab trees, and earlier global_trees.

> (the assert code
> should go to a separate helper function).

Should this checking be done only in
gcc/tree-streamer.c:record_common_node, or should generally
gcc/tree-streamer.c:streamer_tree_cache_append check/assert that such
recursive trees are already present in the cache?  And generally do that,
or "if (flag_checking)" only?

> Did you try it on more than just
> the complex type case?

Not yet, but now that you have approved the general concept, I'll look
into that.

Here's the current patch with the assertion condition fixed, but still
for complex types only.  OK for trunk already?

--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -553,20 +553,6 @@ enum tree_index {
   TI_BOOLEAN_FALSE,
   TI_BOOLEAN_TRUE,
 
-  TI_COMPLEX_INTEGER_TYPE,
-  TI_COMPLEX_FLOAT_TYPE,
-  TI_COMPLEX_DOUBLE_TYPE,
-  TI_COMPLEX_LONG_DOUBLE_TYPE,
-
-  TI_COMPLEX_FLOAT16_TYPE,
-  TI_COMPLEX_FLOATN_NX_TYPE_FIRST = TI_COMPLEX_FLOAT16_TYPE,
-  TI_COMPLEX_FLOAT32_TYPE,
-  TI_COMPLEX_FLOAT64_TYPE,
-  TI_COMPLEX_FLOAT128_TYPE,
-  TI_COMPLEX_FLOAT32X_TYPE,
-  TI_COMPLEX_FLOAT64X_TYPE,
-  TI_COMPLEX_FLOAT128X_TYPE,
-
   TI_FLOAT_TYPE,
   TI_DOUBLE_TYPE,
   TI_LONG_DOUBLE_TYPE,
@@ -596,6 +582,23 @@ enum tree_index {
 			     - TI_FLOATN_NX_TYPE_FIRST		\
 			     + 1)
 
+  /* Put the complex types after their component types, so that in (sequential)
+     tree streaming we can assert that their component types have already been
+     handled (see tree-streamer.c:record_common_node).  */
+  TI_COMPLEX_INTEGER_TYPE,
+  TI_COMPLEX_FLOAT_TYPE,
+  TI_COMPLEX_DOUBLE_TYPE,
+  TI_COMPLEX_LONG_DOUBLE_TYPE,
+
+  TI_COMPLEX_FLOAT16_TYPE,
+  TI_COMPLEX_FLOATN_NX_TYPE_FIRST = TI_COMPLEX_FLOAT16_TYPE,
+  TI_COMPLEX_FLOAT32_TYPE,
+  TI_COMPLEX_FLOAT64_TYPE,
+  TI_COMPLEX_FLOAT128_TYPE,
+  TI_COMPLEX_FLOAT32X_TYPE,
+  TI_COMPLEX_FLOAT64X_TYPE,
+  TI_COMPLEX_FLOAT128X_TYPE,
+
   TI_FLOAT_PTR_TYPE,
   TI_DOUBLE_PTR_TYPE,
   TI_LONG_DOUBLE_PTR_TYPE,
--- gcc/tree-streamer.c
+++ gcc/tree-streamer.c
@@ -278,9 +278,26 @@ 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)
+    {
+      /* Assert that a complex type's component type (node_type) has been
+	 handled already (and we thus don't need to recurse here).  See PR
+	 lto/77458.  */
+      tree node_type = TREE_TYPE (node);
+      if (cache->node_map)
+	gcc_assert (streamer_tree_cache_lookup (cache, node_type, NULL));
+      else
+	{
+	  gcc_assert (cache->nodes.exists ());
+	  bool found = false;
+	  for (unsigned i = 0; !found && i < cache->nodes.length (); ++i)
+	    if (cache->nodes[i] == node_type)
+	      found = true;
+	  gcc_assert (found);
+	}
+    }
   else if (TREE_CODE (node) == RECORD_TYPE)
     {
       /* The FIELD_DECLs of structures should be shared, so that every


Grüße
 Thomas

  reply	other threads:[~2016-09-19 11:20 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 [this message]
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                                           ` Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node Thomas Schwinge
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=87bmzkb0h5.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).