aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenth@gcc.gnu.org>2011-12-09 11:22:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-12-09 11:22:59 +0000
commit48f2e3734233184ff3b7e6f6bc0c27c474a76d29 (patch)
tree3fd14b2819d5df4d70c0d977b8b8eb86af85045f /gcc
parent7a71052e76f0de7f5342cff98ef4ad87b3e4dfdf (diff)
downloadgcc-48f2e3734233184ff3b7e6f6bc0c27c474a76d29.zip
gcc-48f2e3734233184ff3b7e6f6bc0c27c474a76d29.tar.gz
gcc-48f2e3734233184ff3b7e6f6bc0c27c474a76d29.tar.bz2
re PR tree-optimization/51482 (ice: invalid types in conversion to floating point)
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. * g++.dg/torture/pr51482.C: New testcase. From-SVN: r182156
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/torture/pr51482.C30
-rw-r--r--gcc/tree-vect-stmts.c15
4 files changed, 52 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 403ba2a..d56c240 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8ad5ffe..68002fc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..2843591
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr51482.C
@@ -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;
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 8589a85..046a76f 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -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