OSDN Git Service

PR c++/44808
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Jul 2010 14:42:20 +0000 (14:42 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Jul 2010 14:42:20 +0000 (14:42 +0000)
* gimplify.c (gimplify_modify_expr): Only SET_DECL_DEBUG_EXPR if
*from_p is VAR_DECL.

* g++.dg/opt/nrv16.C: New test.

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

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/nrv16.C [new file with mode: 0644]

index a1b5a42..3e7eaa3 100644 (file)
@@ -1,3 +1,9 @@
+2010-07-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/44808
+       * gimplify.c (gimplify_modify_expr): Only SET_DECL_DEBUG_EXPR if
+       *from_p is VAR_DECL.
+
 2010-07-05  Nathan Froyd  <froydnj@codesourcery.com>
 
        * tree.h (build_call_list): Remove.
index 5559f0e..4440af5 100644 (file)
@@ -4559,7 +4559,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
   /* Try to alleviate the effects of the gimplification creating artificial
      temporaries (see for example is_gimple_reg_rhs) on the debug info.  */
   if (!gimplify_ctxp->into_ssa
-      && DECL_P (*from_p)
+      && TREE_CODE (*from_p) == VAR_DECL
       && DECL_IGNORED_P (*from_p)
       && DECL_P (*to_p)
       && !DECL_IGNORED_P (*to_p))
index b05391a..3a7b041 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/44808
+       * g++.dg/opt/nrv16.C: New test.
+
 2010-07-05  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/44784
diff --git a/gcc/testsuite/g++.dg/opt/nrv16.C b/gcc/testsuite/g++.dg/opt/nrv16.C
new file mode 100644 (file)
index 0000000..7b24d4a
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/44808
+// { dg-do compile }
+
+struct S
+{
+  void *a, *b;
+  int c;
+};
+
+S
+foo ()
+{
+  S x;
+  S y = x;
+  return x;
+}