diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-01-03 22:01:14 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-01-03 22:01:14 +0100 |
commit | 1ac12fa2a746eb6b004b604544d6da215770919c (patch) | |
tree | 1af17073eafbd986218e00720fb3527786e46d23 | |
parent | 9766135bb18d75cd0d5257d21de485e953e3505e (diff) | |
download | gcc-1ac12fa2a746eb6b004b604544d6da215770919c.zip gcc-1ac12fa2a746eb6b004b604544d6da215770919c.tar.gz gcc-1ac12fa2a746eb6b004b604544d6da215770919c.tar.bz2 |
re PR tree-optimization/47155 (ccp caused miscompilation)
PR tree-optimization/47155
* tree-ssa-ccp.c (bit_value_binop_1): Use r1type instead of type
when computing uns.
* gcc.c-torture/execute/pr47155.c: New test.
From-SVN: r168440
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr47155.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 4 |
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62bd11e..20e8a8e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-01-03 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/47155 + * tree-ssa-ccp.c (bit_value_binop_1): Use r1type instead of type + when computing uns. + PR rtl-optimization/47157 * combine.c (try_combine): If undobuf.other_insn becomes (set (pc) (pc)) jump, call update_cfg_for_uncondjump on it diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 910fa08..40223f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-01-03 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/47155 + * gcc.c-torture/execute/pr47155.c: New test. + PR rtl-optimization/47157 * gcc.c-torture/compile/pr47157.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr47155.c b/gcc/testsuite/gcc.c-torture/execute/pr47155.c new file mode 100644 index 0000000..6210a2f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr47155.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/47155 */ + +unsigned int a; +static signed char b = -127; +int c = 1; + +int +main (void) +{ + a = b <= (unsigned char) (-6 * c); + if (!a) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 29aa55c..b2494d7 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1764,8 +1764,8 @@ bit_value_binop_1 (enum tree_code code, tree type, tree r1type, double_int r1val, double_int r1mask, tree r2type, double_int r2val, double_int r2mask) { - bool uns = (TREE_CODE (type) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (type) ? 0 : TYPE_UNSIGNED (type)); + bool uns = (TREE_CODE (r1type) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (r1type) ? 0 : TYPE_UNSIGNED (r1type)); /* Assume we'll get a constant result. Use an initial varying value, we fall back to varying in the end if necessary. */ *mask = double_int_minus_one; |