public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Richard Henderson <rth@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PR debug/46724] var-track address of RESULT_DECL
Date: Wed, 29 Dec 2010 09:17:00 -0000	[thread overview]
Message-ID: <orwrmtcf8n.fsf@livre.localdomain> (raw)
In-Reply-To: <AANLkTindYVkbc49HYU9t4cdRHCTRBCvGKcdaKP5-_s+1@mail.gmail.com>	(H. J. Lu's message of "Tue, 28 Dec 2010 10:17:00 -0800")

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Dec 28, 2010, "H.J. Lu" <hjl.tools@gmail.com> wrote:

> On Tue, Dec 21, 2010 at 7:49 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> On Dec 21, 2010, Richard Henderson <rth@redhat.com> wrote:

>>> Ok, with a function comment for vt_add_function_parameter.

>> Thanks, here's what I installed.

> This caused:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47079

Thanks.  Of course, this *had* to happen while my fast build machine was
on repairs, and I ended up cutting down testing to x86_64 only on my
older and slower build box :-(

On x86, .result_ptr was a MEM rather than a REG, and because result_ptr
wasn't a local VAR_DECL, its RTL wasn't properly devirtualized, and
dwarf2out didn't quite know what to do with virtual-incoming-args.

Fixed with the following patch (slightly different from the patch
uploaded to bugzilla, to fix a cut&pasto).  Regstrapped on x86_64 and
x86-linux-gnu.  Ok to install?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: result-decl-value-more-pr47079.patch --]
[-- Type: text/x-diff, Size: 2272 bytes --]

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/47079
	PR debug/46724
	* function.c (instantiate_expr): Instantiate incoming rtl of
	implicit arguments, and recurse on VALUE_EXPRs.
	(instantiate_decls): Instantiate rtl and VALUE_EXPR of result.
	* var-tracking.c (adjust_mems): Reject virtual_incoming_args_rtx.

Index: gcc/function.c
===================================================================
--- gcc/function.c.orig	2010-12-28 20:24:03.881770200 -0200
+++ gcc/function.c	2010-12-28 21:37:47.492920482 -0200
@@ -1784,8 +1784,21 @@ instantiate_expr (tree *tp, int *walk_su
   if (! EXPR_P (t))
     {
       *walk_subtrees = 0;
-      if (DECL_P (t) && DECL_RTL_SET_P (t))
-	instantiate_decl_rtl (DECL_RTL (t));
+      if (DECL_P (t))
+	{
+	  if (DECL_RTL_SET_P (t))
+	    instantiate_decl_rtl (DECL_RTL (t));
+	  if (TREE_CODE (t) == PARM_DECL && DECL_NAMELESS (t)
+	      && DECL_INCOMING_RTL (t))
+	    instantiate_decl_rtl (DECL_INCOMING_RTL (t));
+	  if ((TREE_CODE (t) == VAR_DECL
+	       || TREE_CODE (t) == RESULT_DECL)
+	      && DECL_HAS_VALUE_EXPR_P (t))
+	    {
+	      tree v = DECL_VALUE_EXPR (t);
+	      walk_tree (&v, instantiate_expr, NULL, NULL);
+	    }
+	}
     }
   return NULL;
 }
@@ -1835,6 +1848,18 @@ instantiate_decls (tree fndecl)
 	}
     }
 
+  if ((decl = DECL_RESULT (fndecl))
+      && TREE_CODE (decl) == RESULT_DECL)
+    {
+      if (DECL_RTL_SET_P (decl))
+	instantiate_decl_rtl (DECL_RTL (decl));
+      if (DECL_HAS_VALUE_EXPR_P (decl))
+	{
+	  tree v = DECL_VALUE_EXPR (decl);
+	  walk_tree (&v, instantiate_expr, NULL, NULL);
+	}
+    }
+
   /* Now process all variables defined in the function or its subblocks.  */
   instantiate_decls_1 (DECL_INITIAL (fndecl));
 
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c.orig	2010-12-28 19:14:24.501730254 -0200
+++ gcc/var-tracking.c	2010-12-28 20:43:03.825871640 -0200
@@ -805,6 +805,7 @@ adjust_mems (rtx loc, const_rtx old_rtx,
 	       && hard_frame_pointer_adjustment != -1
 	       && cfa_base_rtx)
 	return compute_cfa_pointer (hard_frame_pointer_adjustment);
+      gcc_checking_assert (loc != virtual_incoming_args_rtx);
       return loc;
     case MEM:
       mem = loc;

[-- Attachment #3: Type: text/plain, Size: 257 bytes --]


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

      reply	other threads:[~2010-12-29  5:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 10:32 Alexandre Oliva
2010-12-21 18:32 ` Richard Henderson
2010-12-22  6:37   ` Alexandre Oliva
2010-12-28 20:26     ` H.J. Lu
2010-12-29  9:17       ` Alexandre Oliva [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=orwrmtcf8n.fsf@livre.localdomain \
    --to=aoliva@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).