diff options
author | Ian Lance Taylor <iant@google.com> | 2010-10-23 16:18:32 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-10-23 16:18:32 +0000 |
commit | 0e1b8b109fb5a19dc3576a14416383299566ff00 (patch) | |
tree | cf7659287d28d44a74afdea7975d98bd017ddb0d /gcc/tree-vrp.c | |
parent | 67f67405cb4f5fec7950c18f5e15da06d4852acb (diff) | |
download | gcc-0e1b8b109fb5a19dc3576a14416383299566ff00.zip gcc-0e1b8b109fb5a19dc3576a14416383299566ff00.tar.gz gcc-0e1b8b109fb5a19dc3576a14416383299566ff00.tar.bz2 |
tree-vrp.c (extract_range_from_binary_expr): If flag_non_call_exceptions don't eliminate division by zero.
gcc/:
* tree-vrp.c (extract_range_from_binary_expr): If
flag_non_call_exceptions don't eliminate division by zero.
* simplify-rtx.c (simplify_binary_operation_1): Likewise.
gcc/testsuite/:
* gcc.c-torture/execute/20101011-1.c: New test.
* gcc.c-torture/execute/20101011-1.x: New test driver.
From-SVN: r165884
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 8ab986e..2103e1b 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2456,6 +2456,22 @@ extract_range_from_binary_expr (value_range_t *vr, } } + /* For divisions, if flag_non_call_exceptions is true, we must + not eliminate a division by zero. */ + if ((code == TRUNC_DIV_EXPR + || code == FLOOR_DIV_EXPR + || code == CEIL_DIV_EXPR + || code == EXACT_DIV_EXPR + || code == ROUND_DIV_EXPR) + && cfun->can_throw_non_call_exceptions + && (vr1.type != VR_RANGE + || symbolic_range_p (&vr1) + || range_includes_zero_p (&vr1))) + { + set_value_range_to_varying (vr); + return; + } + /* For divisions, if op0 is VR_RANGE, we can deduce a range even if op1 is VR_VARYING, VR_ANTI_RANGE, symbolic or can include 0. */ |