On Sat, Nov 11, 2017 at 11:03 PM, Marc Glisse <marc.gli...@inria.fr> wrote: > Hello, > > with undefined overflow, just because we know nothing about one of the > arguments of an addition doesn't mean we can't say something about the > result. We could constrain more the cases where we replace VR_VARYING with a > full VR_RANGE, but I didn't want to duplicate too much logic. > > The 20040409 testcases were introduced to test an RTL transformation, so I > don't feel too bad adding -fwrapv to work around the undefined overflows > they exhibit. > > Bootstrap+regtest on powerpc64le-unknown-linux-gnu.
Index: gcc/testsuite/gcc.c-torture/execute/20040409-1.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/20040409-1.c (revision 254629) +++ gcc/testsuite/gcc.c-torture/execute/20040409-1.c (working copy) @@ -1,10 +1,12 @@ +/* { dg-options "-fwrapv" } */ + I think you should use dg-additional-options (if that works). As said in the PR it would be safest to copy the tests, add -fwrapv and just remove the -fno-wrapv cases that do not work. I think a better fix would be in the caller of extract_range_from_binary_expr_1, like simply always replacing VARYING with [min,max] if either of the two ranges is not varying. In vr_values::extract_range_from_binary_expr that is, and doing an early out for varying & varying in _1. Might simplify some special case code for other opts as well. Richard. > 2017-11-13 Marc Glisse <marc.gli...@inria.fr> > > gcc/ > * tree-vrp.c (extract_range_from_binary_expr_1) [PLUS_EXPR, > MINUS_EXPR]: Use a full range for VR_VARYING. > > gcc/testsuite/ > PR testsuite/82951 > * gcc.c-torture/execute/20040409-1.c: Use -fwrapv. > * gcc.c-torture/execute/20040409-2.c: Likewise. > * gcc.c-torture/execute/20040409-3.c: Likewise. > * gcc.dg/tree-ssa/vrp118.c: New file. > > -- > Marc Glisse