> > That's old code and the comment makes it quite clear why this is done
> > though.
>
> Yeah, but then here "we don't need to evaluate it just for the check"
> applies - the check is dead code as the outer comparison is always
> false. I think what the code in the Ada frontend tries to achieve
>
On Mon, 14 Sep 2015, Eric Botcazou wrote:
> > Ok, so it's folding
> >
> > x == 127 ? .gnat_rcheck_CE_Overflow_Check ("overflow_sum3.adb", 14);, 0 :
> > (short_short_integer) x + 1
> >
> > <= 127
> >
> > where op0 (the COND_EXPR) does not have TREE_SIDE_EFFECTS set but
> > its operand 1 has:
> >
> Ok, so it's folding
>
> x == 127 ? .gnat_rcheck_CE_Overflow_Check ("overflow_sum3.adb", 14);, 0 :
> (short_short_integer) x + 1
>
> <= 127
>
> where op0 (the COND_EXPR) does not have TREE_SIDE_EFFECTS set but
> its operand 1 has:
>
> (gdb) p debug_tree (op0)
> type public visited QI
>
> Still trying to reproduce, but I suppose you hit
The testcase fails as of r227729 on x86-64/Linux.
> /* Comparisons with the highest or lowest possible integer of
> the specified precision will have known values. */
> (simplify
> (cmp (convert?@2 @0) INTEGER_CST@1)
> (if ((INTEGRAL_T
On Mon, 14 Sep 2015, Richard Biener wrote:
> On Sat, 12 Sep 2015, Eric Botcazou wrote:
>
> > > * fold-const.c (fold_binary_loc): Move simplifying of comparisons
> > > against the highest or lowest possible integer ...
> > > * match.pd: ... as patterns here.
> >
> > This incorrectly dropped
On Sat, 12 Sep 2015, Eric Botcazou wrote:
> > * fold-const.c (fold_binary_loc): Move simplifying of comparisons
> > against the highest or lowest possible integer ...
> > * match.pd: ... as patterns here.
>
> This incorrectly dropped the calls to omit_one_operand_loc, resulting in the
> * fold-const.c (fold_binary_loc): Move simplifying of comparisons
> against the highest or lowest possible integer ...
> * match.pd: ... as patterns here.
This incorrectly dropped the calls to omit_one_operand_loc, resulting in the
failure of the attached Ada test: if the oper
This moves simplifying of comparisons against the highest or lowest
possible integer.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
This needs the GENERIC code-gen fix, otherwise we miscompile GCC.
Richard.
2015-07-24 Richard Biener
* fold-const.c (fold_binary_loc