https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70177
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Status|UNCONFIRMED |NEW Last reconfirmed| |2016-03-10 Target Milestone|--- |6.0 Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- derive_constant_upper_bound is called with i_11(D) >= -1 ? 126 - (unsigned int) i_11(D) : 127 and as it is a COND_EXPR, obviously calling it for the 2 operand extract_ops_from_tree doesn't work. Calling extract_ops_from_tree_1 of course fixes the ICE (why haven't we renamed it to extract_ops_from_tree BTW and just use overloading?), though the question is if we can't do better for the COND_EXPR (in that case we'd need to pass it to the *_ops function and handle COND_EXPR in there). But we don't even handle INTEGER_CST - variable. It is a pitty we got COND_EXPR, instead of say MAX_EXPR <126 - (unsigned) i_11(D), 127>. --- gcc/tree-ssa-loop-niter.c.jj 2016-02-24 14:52:16.000000000 +0100 +++ gcc/tree-ssa-loop-niter.c 2016-03-10 23:47:45.407770775 +0100 @@ -2742,9 +2742,9 @@ static widest_int derive_constant_upper_bound (tree val) { enum tree_code code; - tree op0, op1; + tree op0, op1, op2; - extract_ops_from_tree (val, &code, &op0, &op1); + extract_ops_from_tree_1 (val, &code, &op0, &op1, &op2); return derive_constant_upper_bound_ops (TREE_TYPE (val), op0, code, op1); }