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
This commit is contained in:
Marc Glisse 2013-05-16 12:26:51 +02:00 committed by Marc Glisse
parent 3571dde6ea
commit 43bb4dd14d
6 changed files with 31 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2013-05-16 Marc Glisse <marc.glisse@inria.fr>
PR middle-end/57286
* fold-const.c (fold_ternary_loc) <VEC_COND_EXPR>: Disable some
transformations to avoid an infinite loop.
2013-05-16 Marek Polacek <polacek@redhat.com>
* tree-scalar-evolution.c (scev_const_prop): Add more dumps.

View File

@ -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))

View File

@ -1,3 +1,11 @@
2013-05-16 Marc Glisse <marc.glisse@inria.fr>
PR middle-end/57286
* 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.
2013-05-15 Richard Sandiford <rdsandiford@googlemail.com>
PR target/57260

View File

@ -3,13 +3,15 @@
typedef unsigned vec __attribute__((vector_size(4*sizeof(int))));
/* Disabled after PR57286
void f(vec*a,vec*b){
*a=(*a)?-1:(*b<10);
*b=(*b)?(*a<10):0;
}
*/
void g(vec*a,vec*b){
*a=(*a)?(*a<*a):-1;
*b=(*b)?-1:(*b<*b);
// *b=(*b)?-1:(*b<*b);
}
void h(vec*a){
*a=(~*a==5);

View File

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O" } */
typedef int vec __attribute__ ((vector_size (4*sizeof(int))));
void f (vec *x){
*x = (*x < 0) | 1;
}

View File

@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-ccp1" } */
typedef unsigned vec __attribute__ ((vector_size (16)));
typedef unsigned vec __attribute__ ((vector_size (4*sizeof(int))));
void
f (vec *a)
{