aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-05-18 05:37:27 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2007-05-18 05:37:27 +0000
commitb60b471172167ddbfe0ef0e6d2691af28aae9196 (patch)
tree82b59301017fd7caf050bd86c289a5e62f6bbfed
parent0968bb3d1d3090e0caba5101baa43789d41b62cb (diff)
downloadgcc-b60b471172167ddbfe0ef0e6d2691af28aae9196.zip
gcc-b60b471172167ddbfe0ef0e6d2691af28aae9196.tar.gz
gcc-b60b471172167ddbfe0ef0e6d2691af28aae9196.tar.bz2
re PR tree-optimization/31953 (ICE in set_value_range, at tree-vrp.c:305)
./: PR tree-optimization/31953 * tree-vrp.c (set_value_range_to_value): Add equiv parameter. Change all callers. (set_value_range_to_null): Call set_value_range_to_value. (extract_range_from_comparison): Likewise. testsuite/: PR tree-optimization/31953 * gcc.c-torture/compile/pr31953.c: New test. From-SVN: r124823
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr31953.c14
-rw-r--r--gcc/tree-vrp.c24
4 files changed, 40 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7a7dcd1..cbe76f8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2007-05-17 Ian Lance Taylor <iant@google.com>
+
+ PR tree-optimization/31953
+ * tree-vrp.c (set_value_range_to_value): Add equiv parameter.
+ Change all callers.
+ (set_value_range_to_null): Call set_value_range_to_value.
+ (extract_range_from_comparison): Likewise.
+
2007-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* toplev.c (print_version): Output GMP/MPFR version info.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 905f269..96b7c39 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-17 Ian Lance Taylor <iant@google.com>
+
+ PR tree-optimization/31953
+ * gcc.c-torture/compile/pr31953.c: New test.
+
2007-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/builtins-1.c: Test reentrant gamma functions.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr31953.c b/gcc/testsuite/gcc.c-torture/compile/pr31953.c
new file mode 100644
index 0000000..667c9ae
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr31953.c
@@ -0,0 +1,14 @@
+struct WView
+{
+ int hexedit_mode:1;
+};
+toggle_hexedit_mode (struct WView *view)
+{
+ if (view->hexedit_mode)
+ {
+ }
+ else
+ {
+ view->hexedit_mode = !view->hexedit_mode;
+ }
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 5f42ff6..efb4f68 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -358,7 +358,7 @@ set_value_range_to_varying (value_range_t *vr)
infinity when we shouldn't. */
static inline void
-set_value_range_to_value (value_range_t *vr, tree val)
+set_value_range_to_value (value_range_t *vr, tree val, bitmap equiv)
{
gcc_assert (is_gimple_min_invariant (val));
if (is_overflow_infinity (val))
@@ -374,7 +374,7 @@ set_value_range_to_value (value_range_t *vr, tree val)
val = TYPE_MIN_VALUE (TREE_TYPE (val));
}
}
- set_value_range (vr, VR_RANGE, val, val, NULL);
+ set_value_range (vr, VR_RANGE, val, val, equiv);
}
/* Set value range VR to a non-negative range of type TYPE.
@@ -418,8 +418,7 @@ set_value_range_to_nonnull (value_range_t *vr, tree type)
static inline void
set_value_range_to_null (value_range_t *vr, tree type)
{
- tree zero = build_int_cst (type, 0);
- set_value_range (vr, VR_RANGE, zero, zero, vr->equiv);
+ set_value_range_to_value (vr, build_int_cst (type, 0), vr->equiv);
}
@@ -1702,7 +1701,7 @@ extract_range_from_binary_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
- set_value_range_to_value (&vr0, op0);
+ set_value_range_to_value (&vr0, op0, NULL);
else
set_value_range_to_varying (&vr0);
@@ -1710,7 +1709,7 @@ extract_range_from_binary_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op1) == SSA_NAME)
vr1 = *(get_value_range (op1));
else if (is_gimple_min_invariant (op1))
- set_value_range_to_value (&vr1, op1);
+ set_value_range_to_value (&vr1, op1, NULL);
else
set_value_range_to_varying (&vr1);
@@ -2107,7 +2106,7 @@ extract_range_from_unary_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
- set_value_range_to_value (&vr0, op0);
+ set_value_range_to_value (&vr0, op0, NULL);
else
set_value_range_to_varying (&vr0);
@@ -2490,7 +2489,7 @@ extract_range_from_cond_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op0) == SSA_NAME)
vr0 = *(get_value_range (op0));
else if (is_gimple_min_invariant (op0))
- set_value_range_to_value (&vr0, op0);
+ set_value_range_to_value (&vr0, op0, NULL);
else
set_value_range_to_varying (&vr0);
@@ -2498,7 +2497,7 @@ extract_range_from_cond_expr (value_range_t *vr, tree expr)
if (TREE_CODE (op1) == SSA_NAME)
vr1 = *(get_value_range (op1));
else if (is_gimple_min_invariant (op1))
- set_value_range_to_value (&vr1, op1);
+ set_value_range_to_value (&vr1, op1, NULL);
else
set_value_range_to_varying (&vr1);
@@ -2528,7 +2527,10 @@ extract_range_from_comparison (value_range_t *vr, tree expr)
its type may be different from _Bool. Convert VAL to EXPR's
type. */
val = fold_convert (TREE_TYPE (expr), val);
- set_value_range (vr, VR_RANGE, val, val, vr->equiv);
+ if (is_gimple_min_invariant (val))
+ set_value_range_to_value (vr, val, vr->equiv);
+ else
+ set_value_range (vr, VR_RANGE, val, val, vr->equiv);
}
else
/* The result of a comparison is always true or false. */
@@ -2562,7 +2564,7 @@ extract_range_from_expr (value_range_t *vr, tree expr)
else if (TREE_CODE_CLASS (code) == tcc_comparison)
extract_range_from_comparison (vr, expr);
else if (is_gimple_min_invariant (expr))
- set_value_range_to_value (vr, expr);
+ set_value_range_to_value (vr, expr, NULL);
else
set_value_range_to_varying (vr);