This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR 79905] ICE with vector_type
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
--
Nathan Sidwell
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;