This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] dwarf2out crash: missing GTY? (PR 50806)
On Oct 21, 2011, Steve Ellcey <sje@cup.hp.com> wrote:
> On Fri, 2011-10-21 at 21:25 +0200, Jakub Jelinek wrote:
>> My guess would be
>> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180194
>> DEBUG_EXPR certainly shouldn't make it through into mem_loc_descriptor,
>> var-tracking is supposed to resolve that.
>>
>> Jakub
> You are right, the bug started at r180194. I have submitted a bug (PR
> 50826) which includes a cut down test case for the problem.
Thanks for testing this patch on the affected platform. I also
bootstrapped it on {x86_64,i686}-linux-gnu, with and without an
additional patch that looked for debug_exprs in any loc expr associated
with multi-part variables. That didn't get any hits, so I ended up
finding out it is the use of a pseudo to hold the internal_arg_pointer
that leads to a chain of events that results in a debug temp bound to a
hard reg ending up used in MEM addresses of incoming args referenced in
the exprs of other debug temps. (more details in the bug report)
Ok to install?
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/50826
* var-tracking.c (rtx_debug_expr_p): New.
(use_type): Don't use debug exprs to track non-VTA variables.
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c.orig 2011-10-25 02:02:25.588540417 -0200
+++ gcc/var-tracking.c 2011-10-25 02:02:29.655480746 -0200
@@ -4907,6 +4907,18 @@ replace_expr_with_values (rtx loc)
return cselib_subst_to_values (loc, VOIDmode);
}
+/* Return true if *X is a DEBUG_EXPR. Usable as an argument to
+ for_each_rtx to tell whether there are any DEBUG_EXPRs within
+ RTX. */
+
+static int
+rtx_debug_expr_p (rtx *x, void *data ATTRIBUTE_UNUSED)
+{
+ rtx loc = *x;
+
+ return GET_CODE (loc) == DEBUG_EXPR;
+}
+
/* Determine what kind of micro operation to choose for a USE. Return
MO_CLOBBER if no micro operation is to be generated. */
@@ -4988,7 +5000,13 @@ use_type (rtx loc, struct count_use_info
else if (target_for_debug_bind (var_debug_decl (expr)))
return MO_CLOBBER;
else if (track_loc_p (loc, expr, INT_MEM_OFFSET (loc),
- false, modep, NULL))
+ false, modep, NULL)
+ /* Multi-part variables shouldn't refer to one-part
+ variable names such as VALUEs (never happens) or
+ DEBUG_EXPRs (only happens in the presence of debug
+ insns). */
+ && (!MAY_HAVE_DEBUG_INSNS
+ || !for_each_rtx (&XEXP (loc, 0), rtx_debug_expr_p, NULL)))
return MO_USE;
else
return MO_CLOBBER;
--
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