Comments
Patch
@@ -4559,7 +4559,7 @@ gimplify_modify_expr (tree *expr_p, gimp
/* 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))
@@ -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;
+}
Hi! While DECL_DEBUG_EXPR_IS_FROM is accepted on all all decls (with decl_common), {,SET_}_DECL_DEBUG_EXPR only for VAR_DECLs. While that limitation is only in the use of VAR_DECL_CHECK macros in tree.h, var-tracking won't use it for non-VAR_DECLs anyway, so fixed by making sure we do this only for VAR_DECLs. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 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. * g++.dg/opt/nrv16.C: New test. Jakub