OSDN Git Service

2008-09-10 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Sep 2008 15:07:04 +0000 (15:07 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Sep 2008 15:07:04 +0000 (15:07 +0000)
PR middle-end/37432
* tree-inline.c (insert_init_stmt): Make sure to not
insert invalid gimple stores.

* gcc.c-torture/compile/pr37432.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140233 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr37432.c [new file with mode: 0644]
gcc/tree-inline.c

index 5ab022b..c1922b1 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-10  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37432
+       * tree-inline.c (insert_init_stmt): Make sure to not
+       insert invalid gimple stores.
+
 2008-09-10  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/37388
index f6a5b2b..cfa78e9 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-10  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37432
+       * gcc.c-torture/compile/pr37432.c: New testcase.
+
 2008-09-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/37434:
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37432.c b/gcc/testsuite/gcc.c-torture/compile/pr37432.c
new file mode 100644 (file)
index 0000000..747ec34
--- /dev/null
@@ -0,0 +1,9 @@
+static void print_wkb_byte(unsigned char val) {
+    print_wkb_bytes((unsigned char *)&val, 1, 1);
+}
+void InsertMultiPoint(int b) {
+    char a = 1;
+    if (b) a = 0;
+    print_wkb_byte(a);
+}
+
index decdd6c..c38c322 100644 (file)
@@ -1907,6 +1907,22 @@ insert_init_stmt (basic_block bb, gimple init_stmt)
     {
       gimple_stmt_iterator si = gsi_last_bb (bb);
 
+      /* We can end up with init statements that store to a non-register
+         from a rhs with a conversion.  Handle that here by forcing the
+        rhs into a temporary.  gimple_regimplify_operands is not
+        prepared to do this for us.  */
+      if (!is_gimple_reg (gimple_assign_lhs (init_stmt))
+         && is_gimple_reg_type (TREE_TYPE (gimple_assign_lhs (init_stmt)))
+         && gimple_assign_rhs_class (init_stmt) == GIMPLE_UNARY_RHS)
+       {
+         tree rhs = build1 (gimple_assign_rhs_code (init_stmt),
+                            gimple_expr_type (init_stmt),
+                            gimple_assign_rhs1 (init_stmt));
+         rhs = force_gimple_operand_gsi (&si, rhs, true, NULL_TREE, false,
+                                         GSI_NEW_STMT);
+         gimple_assign_set_rhs_code (init_stmt, TREE_CODE (rhs));
+         gimple_assign_set_rhs1 (init_stmt, rhs);
+       }
       gsi_insert_after (&si, init_stmt, GSI_NEW_STMT);
       gimple_regimplify_operands (init_stmt, &si);
       mark_symbols_for_renaming (init_stmt);