> > > > > > > > > Andrew Pinski writes: > > > > > > > I thought that I would not have to ping patches any more > > > > with the patch queue but I am wrong, oh well. > > > > > > > > http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00879.html > > > > [PATCH] Fix PR middle-end/22429, fold building tree which depends on signed overflow > > > > > > > > This fixes one of the wrong-code regressions in 4.1, basicially > > > > fold was building a tree which depends on signed overflowing > > > > being defined as wrapping which is only true with -fwrapv. > > > > > > Setting etype to TREE_TYPE (etype) looks wrong to me. And I suspect > > > that the reason you have to do it is that your patch doesn't set value > > > back to zero. The old code would work because it checks TREE_OVERFLOW > > > again. But your patch effectively does not--it is possible for value > > > to fall through without TREE_OVERFLOW being set. > > > > > > Also, I think the patch makes the code more confusing. In the case of > > > flag_wrapv && !TYPE_UNSIGNED (type), the first computation of value is > > > of no importance. > > > > > > How about something like this? I haven't tested it. > > This works except it introduces two Ada test failures, I am going to look > > into them. They are both ICEs. > > Both of the failure is due to range_binop returning NULL in: > 4047 if (integer_zerop (range_binop (NE_EXPR, integer_type_node, > 4048 minv, 1, maxv, 1))) > > This is due to minv being a non-constant value. > > Let me try the obvious patch to test for that case and see if it works. Here is the patch which works for those two tests and also for my testcase still, it adds the testcase also to the patch. I am right now doing a full bootstrap/test on x86_64-pc-linux-gnu with this patch. Thanks, Andrew Pinski