mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-18 02:14:31 +08:00
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
This commit is contained in:
parent
e4638a72d8
commit
7853504d63
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2004-06-06 Steven Bosscher <stevenb@suse.de>
|
||||||
|
|
||||||
* hooks.c (hook_int_void_1): New generic hook.
|
* hooks.c (hook_int_void_1): New generic hook.
|
||||||
|
@ -3631,6 +3631,7 @@ tree_verify_flow_info (void)
|
|||||||
|
|
||||||
case SWITCH_EXPR:
|
case SWITCH_EXPR:
|
||||||
{
|
{
|
||||||
|
tree prev;
|
||||||
edge e;
|
edge e;
|
||||||
size_t i, n;
|
size_t i, n;
|
||||||
tree vec;
|
tree vec;
|
||||||
@ -3649,6 +3650,34 @@ tree_verify_flow_info (void)
|
|||||||
label_bb->aux = (void *)1;
|
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)
|
for (e = bb->succ; e; e = e->succ_next)
|
||||||
{
|
{
|
||||||
if (!e->dest->aux)
|
if (!e->dest->aux)
|
||||||
|
Loading…
Reference in New Issue
Block a user