aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-01-19 10:27:23 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2005-01-19 10:27:23 +0100
commite89be13bdf98cff1cbbdd9490e4b4d5e20e68baf (patch)
tree93fe2be4ef05d41704144972051044adb8dcf737 /gcc/gimplify.c
parentf0b9dcb843ab406ba561468ce898c39df826d10b (diff)
downloadgcc-e89be13bdf98cff1cbbdd9490e4b4d5e20e68baf.zip
gcc-e89be13bdf98cff1cbbdd9490e4b4d5e20e68baf.tar.gz
gcc-e89be13bdf98cff1cbbdd9490e4b4d5e20e68baf.tar.bz2
re PR c/17297 (ICE with FP vector constructor containing qnan calculation)
PR c/17297 * c-typeck.c (digest_init): Only call build_vector if all constructor elements are *_CST nodes. * gimplify.c (gimplify_init_constructor): Likewise. * gcc.c-torture/compile/20050113-1.c: New testcase. PR middle-end/19164 * c-typeck.c (digest_init): Only call build_vector if inside_init is a CONSTRUCTOR. * gcc.dg/20050113-1.c: New testcase. From-SVN: r93891
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index d86379c..12822c4 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2761,20 +2761,33 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
case VECTOR_TYPE:
/* Go ahead and simplify constant constructors to VECTOR_CST. */
if (TREE_CONSTANT (ctor))
- TREE_OPERAND (*expr_p, 1) = build_vector (type, elt_list);
- else
{
- /* Vector types use CONSTRUCTOR all the way through gimple
- compilation as a general initializer. */
- for (; elt_list; elt_list = TREE_CHAIN (elt_list))
+ tree tem;
+
+ /* Even when ctor is constant, it might contain non-*_CST
+ elements (e.g. { 1.0/0.0 - 1.0/0.0, 0.0 }) and those don't
+ belong into VECTOR_CST nodes. */
+ for (tem = elt_list; tem; tem = TREE_CHAIN (tem))
+ if (! CONSTANT_CLASS_P (TREE_VALUE (tem)))
+ break;
+
+ if (! tem)
{
- enum gimplify_status tret;
- tret = gimplify_expr (&TREE_VALUE (elt_list), pre_p, post_p,
- is_gimple_val, fb_rvalue);
- if (tret == GS_ERROR)
- ret = GS_ERROR;
+ TREE_OPERAND (*expr_p, 1) = build_vector (type, elt_list);
+ break;
}
}
+
+ /* Vector types use CONSTRUCTOR all the way through gimple
+ compilation as a general initializer. */
+ for (; elt_list; elt_list = TREE_CHAIN (elt_list))
+ {
+ enum gimplify_status tret;
+ tret = gimplify_expr (&TREE_VALUE (elt_list), pre_p, post_p,
+ is_gimple_val, fb_rvalue);
+ if (tret == GS_ERROR)
+ ret = GS_ERROR;
+ }
break;
default: