This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix endless recursion in make_vector_type (PR tree-opt/29637; 4.[0123] regression cause by PR c/29092 fix)


On Fri, Oct 13, 2006 at 04:01:16PM +0200, Paolo Bonzini wrote:
> 2006-10-13  Paolo Bonzini  <bonzini@gnu.org>
> 
> 	* tree.c (build_type_attribute_qual_variant): New, based on
> 	build_type_attribute_variant.
> 	(build_type_attribute_variant): Rewrite using the former.
> 	(make_vector_type): Use build_type_attribute_qual_variant to build
> 	type variants.  Use type_hash_canon on the others.

This causes a regression on branches it has been applied to.
E.g. RECORD_TYPE TYPE_MAIN_VARIANT is the type itself, even if it has
attributes.
The following patch fixes that, ok for 4.[0123]?

2006-10-29  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.

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

--- gcc/tree.c.jj	2006-10-29 21:49:23.000000000 +0100
+++ gcc/tree.c	2006-10-29 22:22:22.000000000 +0100
@@ -6400,7 +6400,8 @@ make_vector_type (tree innertype, int nu
 
   /* 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),
--- gcc/testsuite/gcc.dg/pr29637.c.jj	2006-10-29 21:47:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr29637.c	2006-10-29 21:47:26.000000000 +0100
@@ -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;
+}


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]