diff options
author | Diego Novillo <dnovillo@redhat.com> | 2005-06-03 21:07:11 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@gcc.gnu.org> | 2005-06-03 17:07:11 -0400 |
commit | 441e96b5bc6736abb50a7f7927b77e4ab5b57daf (patch) | |
tree | caa57108bab4889bac26004363221e15a6c72c67 /gcc/tree-vrp.c | |
parent | 658a82f8edacdbe5f49eb4309bf5e2fb3dc9b147 (diff) | |
download | gcc-441e96b5bc6736abb50a7f7927b77e4ab5b57daf.zip gcc-441e96b5bc6736abb50a7f7927b77e4ab5b57daf.tar.gz gcc-441e96b5bc6736abb50a7f7927b77e4ab5b57daf.tar.bz2 |
tree-ssa-dom.c (record_edge_info): Use last_basic_block to allocate info array.
* tree-ssa-dom.c (record_edge_info): Use last_basic_block to
allocate info array.
* tree-vrp.c (extract_range_from_unary_expr): Set resulting
range to varying in cast expressions that change
TYPE_PRECISION.
testsuite/ChangeLog
* gcc.dg/tree-ssa/vrp14.c: New test.
From-SVN: r100554
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 74fb829..373e8d9 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1295,17 +1295,23 @@ extract_range_from_unary_expr (value_range_t *vr, tree expr) } /* Handle unary expressions on integer ranges. */ - if ((code == NOP_EXPR || code == CONVERT_EXPR) - && (TYPE_SIZE (TREE_TYPE (vr0.min)) != TYPE_SIZE (TREE_TYPE (expr)))) + if (code == NOP_EXPR || code == CONVERT_EXPR) { + tree inner_type = TREE_TYPE (op0); + tree outer_type = TREE_TYPE (expr); + /* When converting types of different sizes, set the result to VARYING. Things like sign extensions and precision loss may change the range. For instance, if x_3 is of type 'long long int' and 'y_5 = (unsigned short) x_3', if x_3 is ~[0, 0], it is impossible to know at compile time whether y_5 will be ~[0, 0]. */ - set_value_range_to_varying (vr); - return; + if (TYPE_SIZE (inner_type) != TYPE_SIZE (outer_type) + || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type)) + { + set_value_range_to_varying (vr); + return; + } } /* Apply the operation to each end of the range and see what we end |