diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-01 15:09:26 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-01 15:09:26 +0000 |
commit | 2df2af5a7b827bf51a646fe9c0850f4ef3225338 (patch) | |
tree | 5709e23633156cfbfd48cd9e84bb7e3c0bebcc72 /gcc/tree-vrp.c | |
parent | 09c1e135de53e8374a9926ec9357698473cd9127 (diff) | |
download | gcc-2df2af5a7b827bf51a646fe9c0850f4ef3225338.tar.gz |
2008-10-01 Richard Guenther <rguenther@suse.de>
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
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 7 |
1 files changed, 7 insertions, 0 deletions
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) |