[PATCH] Fix PR43629, wrong-code from CCP
Richard Guenther
rguenther@suse.de
Fri Apr 2 16:43:00 GMT 2010
This is a trivial fix for PR43629 as it occurs on trunk. On
the branches it is worse because there SRA exposes this bug
as well.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
I'm in the fortunate position to be RM and maintainer at the
same time, thus approved and committed (heh ;)). Similar
simple and obvious fixes are ok during the "freeze", just
CC me for an approval - I am around most of the time
during easter.
Thanks,
Richard.
2010-04-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43629
* tree-ssa-ccp.c (likely_value): Reset all_undefined_operands
if we have seen a constant value.
* gcc.c-torture/execute/pr43629.c: New testcase.
Index: gcc/testsuite/gcc.c-torture/execute/pr43629.c
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/pr43629.c (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/pr43629.c (revision 0)
***************
*** 0 ****
--- 1,13 ----
+ int flag;
+ extern void abort (void);
+ int main()
+ {
+ int x;
+ if (flag)
+ x = -1;
+ else
+ x &= 0xff;
+ if (x & ~0xff)
+ abort ();
+ return 0;
+ }
Index: gcc/tree-ssa-ccp.c
===================================================================
*** gcc/tree-ssa-ccp.c (revision 157942)
--- gcc/tree-ssa-ccp.c (working copy)
*************** likely_value (gimple stmt)
*** 558,563 ****
--- 558,566 ----
has_constant_operand = true;
}
+ if (has_constant_operand)
+ all_undefined_operands = false;
+
/* If the operation combines operands like COMPLEX_EXPR make sure to
not mark the result UNDEFINED if only one part of the result is
undefined. */
More information about the Gcc-patches
mailing list