[Bug middle-end/57286] [4.9 regression] infinite recurison in fold-const.c:10037

2013-05-15 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57286

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 CC||glisse at gcc dot gnu.org
  Component|tree-optimization   |middle-end
   Target Milestone|--- |4.9.0

--- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
So the comment was correct after all ;)


[Bug middle-end/57286] [4.9 regression] infinite recurison in fold-const.c:10037

2013-05-15 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57286

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-05-15
 Ever confirmed|0   |1

--- Comment #2 from Richard Biener rguenth at gcc dot gnu.org ---
folding

(gdb) call debug_gimple_stmt (stmt)
vect_patt_667.85_618 = VEC_COND_EXPR vect__66.83_624  { 0.0, 0.0 }, { -1, -1
}, { 1, 1 };

cycle via

14256 /* Convert A ? 1 : B into A || B if A and B are truth values.  */
14257 if (code == VEC_COND_EXPR ? integer_all_onesp (arg1) :
integer_onep (arg1)
14258  truth_value_p (TREE_CODE (arg0))
14259  truth_value_p (TREE_CODE (op2))
14260  (code == VEC_COND_EXPR || !VECTOR_TYPE_P (type)))
14261   return fold_build2_loc (loc, code == VEC_COND_EXPR
14262? BIT_IOR_EXPR : TRUTH_ORIF_EXPR,
14263   type, fold_convert_loc (loc, type,
arg0), op2);

and

#2  0x0084f783 in fold_binary_op_with_conditional_arg (loc=0, 
code=BIT_IOR_EXPR, type=0x76c27540, op0=0x76c7e500, 
op1=0x76c7b5c0, cond=0x76c7e500, arg=0x76c7b5c0, 
cond_first_p=1) at /space/rguenther/src/svn/trunk/gcc/fold-const.c:6129
6129  return fold_build3_loc (loc, cond_code, type, test, lhs, rhs);

only one variant should be canonical, obvious for the vector case but
eventually not for the scalar case.


[Bug middle-end/57286] [4.9 regression] infinite recurison in fold-const.c:10037

2013-05-15 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57286

--- Comment #3 from Marc Glisse glisse at gcc dot gnu.org ---
Intuitively, I'd say:

@@ -10041,7 +10041,7 @@

   if (TREE_CODE (arg1) == COND_EXPR
   || TREE_CODE (arg1) == VEC_COND_EXPR
-  || COMPARISON_CLASS_P (arg1))
+  || (COMPARISON_CLASS_P (arg1)  !VECTOR_TYPE_P (TREE_TYPE (arg1
 {
   tem = fold_binary_op_with_conditional_arg (loc, code, type, op0, op1,
  arg1, arg0,

but I don't really have time to think about it right now (meeting).


[Bug middle-end/57286] [4.9 regression] infinite recurison in fold-const.c:10037

2013-05-15 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57286

--- Comment #4 from Marc Glisse glisse at gcc dot gnu.org ---
Shorter testcase:

typedef long vec __attribute__((vector_size(16)));
vec f(vec x){
  return (x0)|1;
}