From 2df2af5a7b827bf51a646fe9c0850f4ef3225338 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 1 Oct 2008 15:09:26 +0000 Subject: 2008-10-01 Richard Guenther PR middle-end/37285 * tree-vrp.c (execute_vrp): If we optimized away the default case make sure to promote the label that got in place of it to a default case label. * gcc.c-torture/compile/pr37285.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140814 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-vrp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/tree-vrp.c') diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 4f1c3288ce7..949b73c2d0a 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7149,9 +7149,16 @@ execute_vrp (void) { size_t j; size_t n = TREE_VEC_LENGTH (su->vec); + tree label; gimple_switch_set_num_labels (su->stmt, n); for (j = 0; j < n; j++) gimple_switch_set_label (su->stmt, j, TREE_VEC_ELT (su->vec, j)); + /* As we may have replaced the default label with a regular one + make sure to make it a real default label again. This ensures + optimal expansion. */ + label = gimple_switch_default_label (su->stmt); + CASE_LOW (label) = NULL_TREE; + CASE_HIGH (label) = NULL_TREE; } if (VEC_length (edge, to_remove_edges) > 0) -- cgit v1.2.1