re PR debug/44367 (-O0 -g wrong DW_AT_location on c++ class retval)
authorJakub Jelinek <jakub@redhat.com>
Wed, 2 Jun 2010 19:55:33 +0000 (21:55 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 2 Jun 2010 19:55:33 +0000 (21:55 +0200)
PR debug/44367
* semantics.c (finalize_nrv): Don't copy DECL_ARTIFICIAL, DECL_IGNORED_P,
DECL_SOURCE_LOCATION and DECL_ABSTRACT_ORIGIN from var to result.
Set DECL_VALUE_EXPR on var.

From-SVN: r160187

gcc/cp/ChangeLog
gcc/cp/cvt.c

index 9a031f99d672da7eb3320d32f2ae2bfff928c3e0..b09d7e9d0d7b923bad264bcfeb8be93e7d2b7822 100644 (file)
        DECL_SOURCE_LOCATION and DECL_ABSTRACT_ORIGIN from var to result.
        Set DECL_VALUE_EXPR on var.
 
+       PR debug/44367
+       * semantics.c (finalize_nrv): Don't copy DECL_ARTIFICIAL, DECL_IGNORED_P,
+       DECL_SOURCE_LOCATION and DECL_ABSTRACT_ORIGIN from var to result.
+       Set DECL_VALUE_EXPR on var.
+
 2010-06-02  Jason Merrill  <jason@redhat.com>
 
        * error.c (dump_type): Improve typedef handling.
index 646610a94bf158c74e83d37091372a0a720a3269..71315b1f4fd40ad9a4d16b431026614db0c825e3 100644 (file)
@@ -822,22 +822,26 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
 tree
 convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
 {
-  tree exprv;
-
   if (expr == error_mark_node
       || TREE_TYPE (expr) == error_mark_node)
     return error_mark_node;
 
-  exprv = expr;
-  while (TREE_CODE (exprv) == COMPOUND_EXPR)
-    exprv = TREE_OPERAND (exprv, 1);
-  if (DECL_P (exprv) || handled_component_p (exprv))
-    /* Expr is not being 'used' here, otherwise we whould have
-       called mark_{rl}value_use use here, which would have in turn
-       called mark_exp_read.  Rather, we call mark_exp_read directly
-       to avoid some warnings when
-       -Wunused-but-set-{variable,parameter} is in effect.  */
-    mark_exp_read (exprv);
+  if (implicit == NULL)
+    mark_exp_read (expr);
+  else
+    {
+      tree exprv = expr;
+
+      while (TREE_CODE (exprv) == COMPOUND_EXPR)
+       exprv = TREE_OPERAND (exprv, 1);
+      if (DECL_P (exprv) || handled_component_p (exprv))
+       /* Expr is not being 'used' here, otherwise we whould have
+          called mark_{rl}value_use use here, which would have in turn
+          called mark_exp_read.  Rather, we call mark_exp_read directly
+          to avoid some warnings when
+          -Wunused-but-set-{variable,parameter} is in effect.  */
+       mark_exp_read (exprv);
+    }
 
   if (!TREE_TYPE (expr))
     return expr;