OSDN Git Service

2009-07-03 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 3 Jul 2009 22:09:12 +0000 (22:09 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 3 Jul 2009 22:09:12 +0000 (22:09 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr40640.c [new file with mode: 0644]
gcc/tree-switch-conversion.c

index 31307ae..2834ac6 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-03  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/40640
+       * tree-switch-conversion.c (build_arrays): Perform arithmetic
+       in original type.
+
 2009-07-03  Jan Hubicka  <jh@suse.cz>
 
        * ipa-inline.c (cgraph_decide_inlining_incrementally): When optimizing
index b739808..d7d4d7e 100644 (file)
@@ -1,5 +1,10 @@
 2009-07-03  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/40640
+       * gcc.c-torture/compile/pr40640.c: New testcase.
+
+2009-07-03  Richard Guenther  <rguenther@suse.de>
+
        PR middle-end/34163
        * gfortran.dg/pr34163.f90: New testcase.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40640.c b/gcc/testsuite/gcc.c-torture/compile/pr40640.c
new file mode 100644 (file)
index 0000000..7dae7ca
--- /dev/null
@@ -0,0 +1,15 @@
+void decode_opic_address(int *);
+void sim_io_printf_filtered2 (int, unsigned);
+void
+hw_opic_io_read_buffer(int index)
+{
+  unsigned reg = 0;
+  decode_opic_address(&index);
+  switch (index)
+    {
+      case 0:
+         reg = 1;
+    }
+  sim_io_printf_filtered2 (index, reg);
+}
+
index 292c49c..2e6808b 100644 (file)
@@ -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;