Commit 7853504d by Steven Bosscher Committed by Steven Bosscher

tree-cfg.c (tree_verify_flow_info): Make sure that labels in SWITCH_LABELS are always sorted.

	* tree-cfg.c (tree_verify_flow_info): Make sure that labels in
	SWITCH_LABELS are always sorted.

From-SVN: r82683
parent e4638a72
2004-06-06 Steven Bosscher <stevenb@suse.de>
* tree-cfg.c (tree_verify_flow_info): Make sure that labels in
SWITCH_LABELS are always sorted.
2004-06-06 Steven Bosscher <stevenb@suse.de>
* hooks.c (hook_int_void_1): New generic hook.
* hooks.h (hook_int_void_1): Add prototype.
* config/c4x/c4x.c (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE):
......
......@@ -3631,6 +3631,7 @@ tree_verify_flow_info (void)
case SWITCH_EXPR:
{
tree prev;
edge e;
size_t i, n;
tree vec;
......@@ -3649,6 +3650,34 @@ tree_verify_flow_info (void)
label_bb->aux = (void *)1;
}
/* Verify that the case labels are sorted. */
prev = TREE_VEC_ELT (vec, 0);
for (i = 1; i < n - 1; ++i)
{
tree c = TREE_VEC_ELT (vec, i);
if (! CASE_LOW (c))
{
error ("Found default case not at end of case vector");
err = 1;
continue;
}
if (! tree_int_cst_lt (CASE_LOW (prev), CASE_LOW (c)))
{
error ("Case labels not sorted:\n ");
print_generic_expr (stderr, prev, 0);
fprintf (stderr," is greater than ");
print_generic_expr (stderr, c, 0);
fprintf (stderr," but comes before it.\n");
err = 1;
}
prev = c;
}
if (CASE_LOW (TREE_VEC_ELT (vec, n - 1)))
{
error ("No default case found at end of case vector");
err = 1;
}
for (e = bb->succ; e; e = e->succ_next)
{
if (!e->dest->aux)
......
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