diff options
author | Ian Bolton <ian.bolton@arm.com> | 2010-08-19 08:12:31 +0000 |
---|---|---|
committer | Ramana Radhakrishnan <ramana@gcc.gnu.org> | 2010-08-19 08:12:31 +0000 |
commit | f096c02afcfad5fbb2e0021af89520c3745084e5 (patch) | |
tree | cb8efc3d295c482a1090305d96edf16eb06c7b35 /gcc/tree-switch-conversion.c | |
parent | d76799c7f0a13ab5a02487f2e6d4dfe10156b223 (diff) | |
download | gcc-f096c02afcfad5fbb2e0021af89520c3745084e5.zip gcc-f096c02afcfad5fbb2e0021af89520c3745084e5.tar.gz gcc-f096c02afcfad5fbb2e0021af89520c3745084e5.tar.bz2 |
For Ian Bolton <ian.bolton@arm.com>
* tree-switch-conversion.c (gen_inbound_check): Ensure that the
type for the conditional has wide enough range.
* testsuite/g++.dg/pr44328.C: New test.
From-SVN: r163366
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r-- | gcc/tree-switch-conversion.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index ed8b5ce..7072af8 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -96,6 +96,7 @@ eight) times the number of the actual switch branches. */ #include "gimple-pretty-print.h" #include "tree-dump.h" #include "timevar.h" +#include "langhooks.h" /* The main structure of the pass. */ struct switch_conv_info @@ -694,9 +695,11 @@ gen_inbound_check (gimple swtch) /* Make sure we do not generate arithmetics in a subrange. */ if (TREE_TYPE (TREE_TYPE (info.index_expr))) - utype = unsigned_type_for (TREE_TYPE (TREE_TYPE (info.index_expr))); + utype = lang_hooks.types.type_for_mode + (TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1); else - utype = unsigned_type_for (TREE_TYPE (info.index_expr)); + utype = lang_hooks.types.type_for_mode + (TYPE_MODE (TREE_TYPE (info.index_expr)), 1); /* (end of) block 0 */ gsi = gsi_for_stmt (info.arr_ref_first); |