summaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-03 22:09:12 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-03 22:09:12 +0000
commit42d9ffa50a7ececb4bd73c18db80a66739f55241 (patch)
treee3367b873291ba1ab60b45a98762a593c7bf410a /gcc/tree-switch-conversion.c
parent89c679bd815aae344e78a0fcd7f61d6528a22a8e (diff)
downloadgcc-42d9ffa50a7ececb4bd73c18db80a66739f55241.tar.gz
2009-07-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40640 * tree-switch-conversion.c (build_arrays): Perform arithmetic in original type. * gcc.c-torture/compile/pr40640.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149211 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 292c49cd126..2e6808b7a4d 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -556,13 +556,13 @@ build_arrays (gimple swtch)
gsi = gsi_for_stmt (swtch);
arr_index_type = build_index_type (info.range_size);
- tmp = create_tmp_var (arr_index_type, "csti");
+ tmp = create_tmp_var (TREE_TYPE (info.index_expr), "csti");
add_referenced_var (tmp);
tidx = make_ssa_name (tmp, NULL);
sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr,
fold_convert (TREE_TYPE (info.index_expr),
info.range_min));
- sub = force_gimple_operand_gsi (&gsi, fold_convert (arr_index_type, sub),
+ sub = force_gimple_operand_gsi (&gsi, sub,
false, NULL, true, GSI_SAME_STMT);
stmt = gimple_build_assign (tidx, sub);
SSA_NAME_DEF_STMT (tidx) = stmt;