------- Comment #4 from rguenth at gcc dot gnu dot org  2005-10-21 10:54 -------
The problem is the condition of the COND_EXPR is not folded:

        arg 0 <eq_expr 0x4002c828 type <boolean_type 0x40027870 bool>

            arg 0 <nop_expr 0x4025a3ac type <integer_type 0x40027654 unsigned
int>
                readonly
                arg 0 <integer_cst 0x4025a154 constant 1>>
            arg 1 <integer_cst 0x4025a3c0 constant 1>>

so the transformation

          /* If this is A op C1 ? A : C2 with C1 and C2 constant integers,
             we might still be able to simplify this.  For example,
             if C1 is one less or one more than C2, this might have started
             out as a MIN or MAX and been transformed by this function.
             Only good for INTEGER_TYPEs, because we need TYPE_MAX_VALUE.  */

          if (INTEGRAL_TYPE_P (type)
              && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
              && TREE_CODE (arg2) == INTEGER_CST)
            switch (comp_code)
              {
              case EQ_EXPR:
                /* We can replace A with C1 in this case.  */
                arg1 = fold_convert (type, TREE_OPERAND (arg0, 1));
                return fold (build (code, type, TREE_OPERAND (t, 0), arg1,
                                    TREE_OPERAND (t, 2)));

does not make any changes.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24470

Reply via email to