aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-streamer.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2016-10-19 12:48:46 +0200
committerThomas Schwinge <tschwinge@gcc.gnu.org>2016-10-19 12:48:46 +0200
commit3b834a2e0161ace8a7b494dfc6794d61ba200706 (patch)
treecac09dcff81f9e30d164873c8d71e870e48397c9 /gcc/tree-streamer.c
parentaff98801acf8f627d317c1f30cd6f59af55dbf79 (diff)
downloadgcc-3b834a2e0161ace8a7b494dfc6794d61ba200706.zip
gcc-3b834a2e0161ace8a7b494dfc6794d61ba200706.tar.gz
gcc-3b834a2e0161ace8a7b494dfc6794d61ba200706.tar.bz2
[PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types
gcc/ PR lto/77458 * tree-core.h (enum tree_index): Put the complex types after their component types. * tree-streamer.c (verify_common_node_recorded): New function. (preload_common_nodes) <TREE_CODE (node) == COMPLEX_TYPE>: Use it. From-SVN: r241338
Diffstat (limited to 'gcc/tree-streamer.c')
-rw-r--r--gcc/tree-streamer.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/gcc/tree-streamer.c b/gcc/tree-streamer.c
index 2139e96..70054b1 100644
--- a/gcc/tree-streamer.c
+++ b/gcc/tree-streamer.c
@@ -248,6 +248,32 @@ streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
}
+/* Verify that NODE is in CACHE. */
+
+static void
+verify_common_node_recorded (struct streamer_tree_cache_d *cache, tree node)
+{
+ /* Restrict this to flag_checking only because in general violating it is
+ harmless plus we never know what happens on all targets/frontend/flag(!)
+ combinations. */
+ if (!flag_checking)
+ return;
+
+ if (cache->node_map)
+ gcc_assert (streamer_tree_cache_lookup (cache, node, NULL));
+ else
+ {
+ bool found = false;
+ gcc_assert (cache->nodes.exists ());
+ /* Linear search... */
+ for (unsigned i = 0; !found && i < cache->nodes.length (); ++i)
+ if (cache->nodes[i] == node)
+ found = true;
+ gcc_assert (found);
+ }
+}
+
+
/* Record NODE in CACHE. */
static void
@@ -293,11 +319,15 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node)
/* 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 COMPLEX_TYPE:
+ /* Verify that a complex type's component type (node_type) has been
+ handled already (and we thus don't need to recurse here). */
+ verify_common_node_recorded (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.