OSDN Git Service

2011-12-09 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Dec 2011 11:22:59 +0000 (11:22 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Dec 2011 11:22:59 +0000 (11:22 +0000)
PR tree-optimization/51482
* tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
Make sure to only create REAL_TYPE and INTEGER_TYPE component
vectors.

* g++.dg/torture/pr51482.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182156 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr51482.C [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 403ba2a..d56c240 100644 (file)
@@ -1,3 +1,10 @@
+2011-12-09  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/51482
+       * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
+       Make sure to only create REAL_TYPE and INTEGER_TYPE component
+       vectors.
+
 2011-12-09  Kai Tietz  <ktietz@redhat.com>
 
        * implicit-zee.c (num_realized): Change type to long.
index 8ad5ffe..68002fc 100644 (file)
@@ -1,6 +1,11 @@
+2011-12-09  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/51482
+       * g++.dg/torture/pr51482.C: New testcase.
+
 2011-12-08  Andrew Pinski  <apinski@cavium.com>
 
-       * cc.target/mips/mult-1.c: Forbid all Octeon processors.
+       * gcc.target/mips/mult-1.c: Forbid all Octeon processors.
        * gcc.target/mips/dmult-1.c: Likewise.
        * gcc.target/mips/branch-1.c: Likewise.
        * gcc.target/mips/extend-1.c: Likewise.
diff --git a/gcc/testsuite/g++.dg/torture/pr51482.C b/gcc/testsuite/g++.dg/torture/pr51482.C
new file mode 100644 (file)
index 0000000..2843591
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+typedef enum { CLASS_IN = 1, CLASS_OUT = -1 } FERGUSON_KEY_CLASS, BEZIER_KEY_CLASS;
+typedef class flag_interface { } VECT3DF_SIMPLE;
+typedef struct vect3df {
+    float x,y,z;
+} VECT3DF, VECT;
+typedef struct vect4df : public vect3df {
+    float w;
+} VECT4DF, WVECT;
+typedef class llist_item { } ANIM_KEY;
+typedef class anim_track : public flag_interface, public llist_item { } ANIM_KEY_BEZ;
+typedef class anim_track_bezier : public anim_track { } ANIM_KEY_BEZ_WVECT;
+typedef class anim_track_bez_wvect : public anim_track_bezier {
+    WVECT * tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn);
+} ANIM_TRACK_BEZ_WVECT;
+WVECT * anim_track_bez_wvect::tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn)
+{
+  float bias,continuity,tension,tn1,bp1;
+  WVECT *p_p0,*p_p1,*p_p2,         t1,         g1,g2,g3;
+  g1.x = (p_p1->x - p_p0->x)*bp1;
+  g1.y = (p_p1->y - p_p0->y)*bp1;
+  g1.z = (p_p1->z - p_p0->z)*bp1;
+  g1.w = (p_p1->w - p_p0->w)*bp1;
+  bp1 = (0.5f + key_class*0.5f*continuity);
+  p_tn->x = (g1.x + g3.x*bp1)*tn1;
+  p_tn->y = (g1.y + g3.y*bp1)*tn1;
+  p_tn->z = (g1.z + g3.z*bp1)*tn1;
+  p_tn->w = (g1.w + g3.w*bp1)*tn1;
+}
index 8589a85..046a76f 100644 (file)
@@ -5705,6 +5705,10 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size)
   if (nbytes == 0)
     return NULL_TREE;
 
+  if (GET_MODE_CLASS (inner_mode) != MODE_INT
+      && GET_MODE_CLASS (inner_mode) != MODE_FLOAT)
+    return NULL_TREE;
+
   /* We can't build a vector type of elements with alignment bigger than
      their size.  */
   if (nbytes < TYPE_ALIGN_UNIT (scalar_type))
@@ -5713,16 +5717,15 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size)
   /* For vector types of elements whose mode precision doesn't
      match their types precision we use a element type of mode
      precision.  The vectorization routines will have to make sure
-     they support the proper result truncation/extension.  */
+     they support the proper result truncation/extension.
+     We also make sure to build vector types with INTEGER_TYPE
+     component type only.  */
   if (INTEGRAL_TYPE_P (scalar_type)
-      && GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type))
+      && (GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type)
+         || TREE_CODE (scalar_type) != INTEGER_TYPE))
     scalar_type = build_nonstandard_integer_type (GET_MODE_BITSIZE (inner_mode),
                                                  TYPE_UNSIGNED (scalar_type));
 
-  if (GET_MODE_CLASS (inner_mode) != MODE_INT
-      && GET_MODE_CLASS (inner_mode) != MODE_FLOAT)
-    return NULL_TREE;
-
   /* We shouldn't end up building VECTOR_TYPEs of non-scalar components.
      When the component mode passes the above test simply use a type
      corresponding to that mode.  The theory is that any use that