]> gcc.gnu.org Git - gcc.git/commitdiff
tree-switch-conversion.c (gen_inbound_check): Make sure the type in which we generate...
authorMartin Jambor <mjambor@suse.cz>
Mon, 14 Jul 2008 11:28:39 +0000 (13:28 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 14 Jul 2008 11:28:39 +0000 (13:28 +0200)
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

gcc/ChangeLog
gcc/tree-switch-conversion.c

index 30813d89b18682ba582a9146bf928754f92ec95c..aa13213fc86a4ab2fc46ee13f9249e006ee1601f 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 0ce5fc91ead931219a69920cf4507f39cdf97a99..36c87f9bd5184932c1a4ad3260b523bb75b0d999 100644 (file)
@@ -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");
This page took 0.108776 seconds and 5 git commands to generate.