Commit 288bd0d7 by Richard Guenther Committed by Richard Biener

re PR middle-end/34154 (gcc 4.1.1 bug / case ranges / unsigned long long)

2007-11-20  Richard Guenther  <rguenther@suse.de>

	PR middle-end/34154
	* gimplify.c (gimplify_switch_expr): Use tree_int_cst_lt instead
	of the signed INT_CST_LT.
	* stmt.c (expand_case): Likewise.
	(estimate_case_costs): Likewise.

	* testsuite/gcc.c-torture/execute/pr34154.c: New testcase.

From-SVN: r130324
parent aa7a6eb4
2007-11-20 Richard Guenther <rguenther@suse.de>
PR middle-end/34154
* gimplify.c (gimplify_switch_expr): Use tree_int_cst_lt instead
of the signed INT_CST_LT.
* stmt.c (expand_case): Likewise.
(estimate_case_costs): Likewise.
2007-11-20 Rask Ingemann Lambertsen <rask@sygehus.dk> 2007-11-20 Rask Ingemann Lambertsen <rask@sygehus.dk>
* read-rtl.c (fatal_expected_char): Print EOF as text rather that * read-rtl.c (fatal_expected_char): Print EOF as text rather that
...@@ -1413,7 +1413,7 @@ gimplify_switch_expr (tree *expr_p, tree *pre_p) ...@@ -1413,7 +1413,7 @@ gimplify_switch_expr (tree *expr_p, tree *pre_p)
{ {
/* Discard empty ranges. */ /* Discard empty ranges. */
tree high = CASE_HIGH (elt); tree high = CASE_HIGH (elt);
if (high && INT_CST_LT (high, low)) if (high && tree_int_cst_lt (high, low))
remove_element = TRUE; remove_element = TRUE;
} }
else else
......
...@@ -2360,7 +2360,7 @@ expand_case (tree exp) ...@@ -2360,7 +2360,7 @@ expand_case (tree exp)
high = CASE_HIGH (elt); high = CASE_HIGH (elt);
/* Discard empty ranges. */ /* Discard empty ranges. */
if (high && INT_CST_LT (high, low)) if (high && tree_int_cst_lt (high, low))
continue; continue;
case_list = add_case_node (case_list, index_type, low, high, case_list = add_case_node (case_list, index_type, low, high,
...@@ -2387,9 +2387,9 @@ expand_case (tree exp) ...@@ -2387,9 +2387,9 @@ expand_case (tree exp)
} }
else else
{ {
if (INT_CST_LT (n->low, minval)) if (tree_int_cst_lt (n->low, minval))
minval = n->low; minval = n->low;
if (INT_CST_LT (maxval, n->high)) if (tree_int_cst_lt (maxval, n->high))
maxval = n->high; maxval = n->high;
} }
/* A range counts double, since it requires two compares. */ /* A range counts double, since it requires two compares. */
...@@ -2664,7 +2664,8 @@ estimate_case_costs (case_node_ptr node) ...@@ -2664,7 +2664,8 @@ estimate_case_costs (case_node_ptr node)
for (n = node; n; n = n->right) for (n = node; n; n = n->right)
{ {
if ((INT_CST_LT (n->low, min_ascii)) || INT_CST_LT (max_ascii, n->high)) if (tree_int_cst_lt (n->low, min_ascii)
|| tree_int_cst_lt (max_ascii, n->high))
return 0; return 0;
for (i = (HOST_WIDE_INT) TREE_INT_CST_LOW (n->low); for (i = (HOST_WIDE_INT) TREE_INT_CST_LOW (n->low);
......
2007-11-20 Richard Guenther <rguenther@suse.de>
PR middle-end/34154
* testsuite/gcc.c-torture/execute/pr34154.c: New testcase.
2007-11-20 Uros Bizjak <ubizjak@gmail.com> 2007-11-20 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/tree-ssa/20030714-1.c: Cleanup dom3 dump file. * gcc.dg/tree-ssa/20030714-1.c: Cleanup dom3 dump file.
int foo( unsigned long long aLL )
{
switch( aLL )
{
case 1000000000000000000ULL ... 9999999999999999999ULL : return 19 ;
default : return 20 ;
};
};
extern void abort (void);
int main()
{
unsigned long long aLL = 1000000000000000000ULL;
if (foo (aLL) != 19)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment