diff mbox

[PR,79905] ICE with vector_type

Message ID 06e56d03-48eb-10cf-7214-171cd048a1d2@acm.org
State New
Headers show

Commit Message

Nathan Sidwell April 4, 2017, 6:02 p.m. UTC
On 04/04/2017 01:40 PM, Bill Schmidt wrote:
> At first blush, the POC patch breaks every test that uses -flto.  I'll see if I can dig deeper after a bit,
> in case this doesn't make the problem obvious.

Try this.

nathan

Comments

Bill Schmidt April 4, 2017, 8:46 p.m. UTC | #1
> On Apr 4, 2017, at 1:02 PM, Nathan Sidwell <nathan@acm.org> wrote:
> 
> On 04/04/2017 01:40 PM, Bill Schmidt wrote:
>> At first blush, the POC patch breaks every test that uses -flto.  I'll see if I can dig deeper after a bit,
>> in case this doesn't make the problem obvious.
> 
> Try this.

Thanks, Nathan, that regstraps cleanly on powerpc64le and fixes the test case in the PR.

Bill

> 
> nathan
> 
> -- 
> Nathan Sidwell
> <79905-3.diff>
diff mbox

Patch

Index: c-family/c-common.c
===================================================================
--- c-family/c-common.c	(revision 246647)
+++ c-family/c-common.c	(working copy)
@@ -7465,7 +7465,8 @@  set_underlying_type (tree x)
 {
   if (x == error_mark_node)
     return;
-  if (DECL_IS_BUILTIN (x) && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
+  if (DECL_IS_BUILTIN (x) && TYPE_NAME (TREE_TYPE (x)) != error_mark_node
+      && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
     {
       if (TYPE_NAME (TREE_TYPE (x)) == 0)
 	TYPE_NAME (TREE_TYPE (x)) = x;
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 246647)
+++ config/rs6000/rs6000.c	(working copy)
@@ -17459,9 +17459,28 @@  rs6000_init_builtins (void)
   tdecl = add_builtin_type ("__vector unsigned int", unsigned_V4SI_type_node);
   TYPE_NAME (unsigned_V4SI_type_node) = tdecl;
 
-  tdecl = add_builtin_type ("__vector signed int", V4SI_type_node);
-  TYPE_NAME (V4SI_type_node) = tdecl;
+  { // Ugly POC hack
+    TYPE_NAME (V4SI_type_node) = error_mark_node; // placeholder
+    tdecl = add_builtin_type ("__vector signed int", V4SI_type_node);
+    TYPE_NAME (V4SI_type_node) = NULL_TREE; // restore
 
+    if (tdecl) 
+      {
+	// Ew, change the underlying type
+#if 0
+	DECL_ORIGINAL_TYPE (tdecl) = V4SI_type_node;
+	tree clone = build_variant_type_copy (V4SI_type_node);
+	TYPE_STUB_DECL (clone) = TYPE_STUB_DECL (V4SI_type_node);
+	TYPE_NAME (clone) = tdecl;
+
+	TREE_USED (clone) = 1;
+	TREE_TYPE (tdecl) = clone;
+#endif
+	TREE_USED (TREE_TYPE (tdecl)) = true;
+	V4SI_type_node = TREE_TYPE (tdecl);
+      }
+  }
+  
   tdecl = add_builtin_type ("__vector __bool int", bool_V4SI_type_node);
   TYPE_NAME (bool_V4SI_type_node) = tdecl;