aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2013-05-16 12:26:51 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2013-05-16 10:26:51 +0000
commit43bb4dd14d015211a19ccd8c1802cc7e1361d8b7 (patch)
tree9493047601849c95b5770ec075bca0b02745c32d /gcc/fold-const.c
parent3571dde6ea6bd573390e1b3e91a646c572b6587e (diff)
downloadgcc-43bb4dd14d015211a19ccd8c1802cc7e1361d8b7.zip
gcc-43bb4dd14d015211a19ccd8c1802cc7e1361d8b7.tar.gz
gcc-43bb4dd14d015211a19ccd8c1802cc7e1361d8b7.tar.bz2
re PR middle-end/57286 (infinite recursion in fold-const.c:10037)
2013-05-16 Marc Glisse <marc.glisse@inria.fr> PR middle-end/57286 gcc/ * fold-const.c (fold_ternary_loc) <VEC_COND_EXPR>: Disable some transformations to avoid an infinite loop. gcc/testsuite/ * gcc.dg/pr57286.c: New testcase. * gcc.dg/vector-shift-2.c: Don't assume int has size 4. * g++.dg/ext/vector22.C: Comment out transformations not performed anymore. From-SVN: r198964
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e02f0c6..97b5216 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -14211,6 +14211,12 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
fold_convert_loc (loc, type,
TREE_OPERAND (arg0, 0)));
+ /* Disable the transformations below for vectors, since
+ fold_binary_op_with_conditional_arg may undo them immediately,
+ yielding an infinite loop. */
+ if (code == VEC_COND_EXPR)
+ return NULL_TREE;
+
/* Convert A ? B : 0 into A && B if A and B are truth values. */
if (integer_zerop (op2)
&& truth_value_p (TREE_CODE (arg0))