diff options
author | Martin Jambor <mjambor@suse.cz> | 2008-07-14 13:28:39 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2008-07-14 13:28:39 +0200 |
commit | 145544ab093faacab5a7349f0ceaf96a70733cf0 (patch) | |
tree | be64e6c5a2aed9974065eba8e46a55f61fee25eb /gcc | |
parent | 9bfb0f015e25775ad8ef660aa7917c0dabc5eb27 (diff) | |
download | gcc-145544ab093faacab5a7349f0ceaf96a70733cf0.zip gcc-145544ab093faacab5a7349f0ceaf96a70733cf0.tar.gz gcc-145544ab093faacab5a7349f0ceaf96a70733cf0.tar.bz2 |
tree-switch-conversion.c (gen_inbound_check): Make sure the type in which we generate arithmetics is not a subrange.
2008-07-14 Martin Jambor <mjambor@suse.cz>
* tree-switch-conversion.c (gen_inbound_check): Make sure the type
in which we generate arithmetics is not a subrange.
From-SVN: r137783
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30813d8..aa13213 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2008-07-14 Martin Jambor <mjambor@suse.cz> + * tree-switch-conversion.c (gen_inbound_check): Make sure the type + in which we generate arithmetics is not a subrange. + +2008-07-14 Martin Jambor <mjambor@suse.cz> + * Makefile.in (IPA_PROP_H): Added ipa-prop.h to IPA_PROP_H variable. 2008-07-14 Richard Guenther <rguenther@suse.de> diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 0ce5fc9..36c87f9 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -622,7 +622,7 @@ gen_inbound_check (tree swtch) tree label_decl3 = create_artificial_label (); tree label1, label2, label3; - tree utype = unsigned_type_for (TREE_TYPE (info.index_expr)); + tree utype; tree tmp_u; tree cast, cast_assign; tree ulb, minus, minus_assign; @@ -638,6 +638,12 @@ gen_inbound_check (tree swtch) gcc_assert (info.default_values); bb0 = bb_for_stmt (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))); + else + utype = unsigned_type_for (TREE_TYPE (info.index_expr)); + /* (end of) block 0 */ bsi = bsi_for_stmt (info.arr_ref_first); tmp_u = make_rename_temp (utype, "csui"); |