re PR c/29736 (ICE on duplicate vector attribute)
authorJakub Jelinek <jakub@redhat.com>
Fri, 24 Nov 2006 21:23:23 +0000 (22:23 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 24 Nov 2006 21:23:23 +0000 (22:23 +0100)
PR c/29736
* c-common.c (handle_vector_size_attribute): Disallow VECTOR_TYPE
or UNION_TYPE inner types.

* gcc.dg/pr29736.c: New test.

From-SVN: r119165

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr29736.c [new file with mode: 0644]

index 12c14defe88e001f100da10854abfa5189eb3f08..b92949e202e90fa30138d5173610f6bee749ca01 100644 (file)
@@ -1,3 +1,9 @@
+2006-11-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/29736
+       * c-common.c (handle_vector_size_attribute): Disallow VECTOR_TYPE
+       or UNION_TYPE inner types.
+
 2006-11-24  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR tree-opt/29964
index 8e4cbff3b9ec7827ac5ecaa6785e651bb466682b..d576955f88879b2b266e115b59ebe1d72ee9866d 100644 (file)
@@ -5450,6 +5450,8 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
   orig_mode = TYPE_MODE (type);
 
   if (TREE_CODE (type) == RECORD_TYPE
+      || TREE_CODE (type) == UNION_TYPE
+      || TREE_CODE (type) == VECTOR_TYPE
       || (!SCALAR_FLOAT_MODE_P (orig_mode)
          && GET_MODE_CLASS (orig_mode) != MODE_INT)
       || !host_integerp (TYPE_SIZE_UNIT (type), 1))
index 49a333b7806581e30b5460be6390739bec12f595..473307a7d3ef5de17ead103b4210756bc2635e48 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/29736
+       * gcc.dg/pr29736.c: New test.
+
 2006-11-24  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR tree-opt/29964
diff --git a/gcc/testsuite/gcc.dg/pr29736.c b/gcc/testsuite/gcc.dg/pr29736.c
new file mode 100644 (file)
index 0000000..54eb9aa
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR c/29736 */
+
+int __attribute__ ((vector_size (8), vector_size (8))) v; /* { dg-error "invalid vector type" } */
+
+extern int __attribute__ ((vector_size (8))) w;
+int __attribute__ ((vector_size (8))) w;
+
+void
+foo ()
+{
+  v = v + v;
+  w = w + w;
+}