]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/29637 (Endless recursion in make_vector_type)
authorJakub Jelinek <jakub@redhat.com>
Mon, 30 Oct 2006 08:08:41 +0000 (09:08 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 30 Oct 2006 08:08:41 +0000 (09:08 +0100)
PR tree-optimization/29637
* tree.c (make_vector_type): Don't recurse if TYPE_MAIN_VARIANT
of the innertype is the innertype itself.

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

From-SVN: r118178

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr29637.c [new file with mode: 0644]
gcc/tree.c

index 34d85384c9661e3f76799da749c1a0552a370344..674744c32f258b5e91010a29a81d07ead5de5caf 100644 (file)
@@ -1,7 +1,12 @@
+2006-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/29637
+       * tree.c (make_vector_type): Don't recurse if TYPE_MAIN_VARIANT
+       of the innertype is the innertype itself.
+
 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
 
        PR c/29092
-
         * c-typeck.c (digest_init): Always allow initializing vectors
        that have static storage duration with compound literals.
        * tree.c (build_type_attribute_qual_variant): New, based on
index 8d60f378152f35ff4a326980390af80dcd2c0849..2f8aad59760091183c10b3543feb3d77f5a8007c 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/29637
+       * gcc.dg/pr29637.c: New test.
+
 2006-10-25  Steve Ellcey  <sje@cup.hp.com>
 
        * gcc.dg/pthread-init-2.c: Define _POSIX_C_SOURCE on ia64 HP-UX.
diff --git a/gcc/testsuite/gcc.dg/pr29637.c b/gcc/testsuite/gcc.dg/pr29637.c
new file mode 100644 (file)
index 0000000..5dfee41
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR tree-optimization/29637 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize" } */
+
+typedef struct __attribute__ ((aligned (8)))
+{
+    short a, b, c, d;
+} A;
+
+typedef struct
+{
+  A a[24];
+} B;
+
+static const A b = { 0, 0, 1, -1 };
+
+void
+foo (B *x)
+{
+  int i;
+  for (i = 0; i <= 20; i += 4)
+    x->a[i] = b;
+}
index c80960002a86041e7cf6ed128fb511665a9ddf07..17399352d032bc1ffb1a1b948572667971e40c4d 100644 (file)
@@ -5624,7 +5624,8 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
 
   /* Build a main variant, based on the main variant of the inner type, then
      use it to build the variant we return.  */
-  if (TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype))
+  if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype))
+      && TYPE_MAIN_VARIANT (innertype) != innertype)
     return build_type_attribute_qual_variant (
            make_vector_type (TYPE_MAIN_VARIANT (innertype), nunits, mode),
            TYPE_ATTRIBUTES (innertype),