This patch fixes a bug in exposed in LIPO build (ICE in copy tree node). ...
10 years, 11 months ago
(2013-05-24 23:27:00 UTC)
#1
This patch fixes a bug in exposed in LIPO build (ICE in copy tree node).
Tested with bookstrap and google internal benchmarks.
-Rong
2013-05-24 Rong Xu <xur@google.com>
Google ref b/8963414.
* gcc/tree-inline.c (add_local_variables): Not map
to deleted debug expression.
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c (revision 199128)
+++ gcc/tree-inline.c (working copy)
@@ -3788,6 +3788,17 @@ add_local_variables (struct function *callee, stru
{
tree tem = DECL_DEBUG_EXPR (var);
bool old_regimplify = id->regimplify;
+
+ /* The mapped debug expression might be deleted
+ as a varpool node (the reachbility analysis
+ of varpool node does not check the reference
+ from debug expressions.
+ Set it to 0 if that's the case. */
+ if (L_IPO_COMP_MODE && tem &&
+ (TREE_STATIC (tem) || DECL_EXTERNAL(tem)) &&
+ real_varpool_node (tem) == NULL)
+ tem = NULL;
+
id->remapping_type_depth++;
walk_tree (&tem, copy_tree_body_r, id, NULL);
id->remapping_type_depth--;
--
This patch is available for review at http://codereview.appspot.com/9760043
On Fri, May 24, 2013 at 4:26 PM, Rong Xu <xur@google.com> wrote: > This patch ...
10 years, 11 months ago
(2013-05-25 02:18:28 UTC)
#2
On Fri, May 24, 2013 at 4:26 PM, Rong Xu <xur@google.com> wrote:
> This patch fixes a bug in exposed in LIPO build (ICE in copy tree node).
>
> Tested with bookstrap and google internal benchmarks.
>
> -Rong
>
> 2013-05-24 Rong Xu <xur@google.com>
> Google ref b/8963414.
> * gcc/tree-inline.c (add_local_variables): Not map
> to deleted debug expression.
>
> Index: gcc/tree-inline.c
> ===================================================================
> --- gcc/tree-inline.c (revision 199128)
> +++ gcc/tree-inline.c (working copy)
> @@ -3788,6 +3788,17 @@ add_local_variables (struct function *callee, stru
> {
> tree tem = DECL_DEBUG_EXPR (var);
> bool old_regimplify = id->regimplify;
> +
> + /* The mapped debug expression might be deleted
> + as a varpool node (the reachbility analysis
> + of varpool node does not check the reference
> + from debug expressions.
> + Set it to 0 if that's the case. */
> + if (L_IPO_COMP_MODE && tem &&
> + (TREE_STATIC (tem) || DECL_EXTERNAL(tem)) &&
> + real_varpool_node (tem) == NULL)
> + tem = NULL;
> +
> id->remapping_type_depth++;
> walk_tree (&tem, copy_tree_body_r, id, NULL);
> id->remapping_type_depth--;
IIUC, it is the real target var-decl of VAR that gets removed from
lipo's symtab thus calling real_var_pool_node later will trigger
gcc_assert. This fix just moved the assertion earlier?
It should be ok for now to just drop the debug expr if the var is
static/global.
David
>
> --
> This patch is available for review at http://codereview.appspot.com/9760043
On Fri, May 24, 2013 at 7:18 PM, Xinliang David Li <davidxl@google.com> wrote: > > ...
10 years, 11 months ago
(2013-05-30 20:17:37 UTC)
#3
On Fri, May 24, 2013 at 7:18 PM, Xinliang David Li <davidxl@google.com>
wrote:
>
> On Fri, May 24, 2013 at 4:26 PM, Rong Xu <xur@google.com> wrote:
> > This patch fixes a bug in exposed in LIPO build (ICE in copy tree node).
> >
> > Tested with bookstrap and google internal benchmarks.
> >
> > -Rong
> >
> > 2013-05-24 Rong Xu <xur@google.com>
> > Google ref b/8963414.
> > * gcc/tree-inline.c (add_local_variables): Not map
> > to deleted debug expression.
> >
> > Index: gcc/tree-inline.c
> > ===================================================================
> > --- gcc/tree-inline.c (revision 199128)
> > +++ gcc/tree-inline.c (working copy)
> > @@ -3788,6 +3788,17 @@ add_local_variables (struct function *callee,
stru
> > {
> > tree tem = DECL_DEBUG_EXPR (var);
> > bool old_regimplify = id->regimplify;
> > +
> > + /* The mapped debug expression might be deleted
> > + as a varpool node (the reachbility analysis
> > + of varpool node does not check the reference
> > + from debug expressions.
> > + Set it to 0 if that's the case. */
> > + if (L_IPO_COMP_MODE && tem &&
> > + (TREE_STATIC (tem) || DECL_EXTERNAL(tem)) &&
> > + real_varpool_node (tem) == NULL)
> > + tem = NULL;
> > +
> > id->remapping_type_depth++;
> > walk_tree (&tem, copy_tree_body_r, id, NULL);
> > id->remapping_type_depth--;
>
>
> IIUC, it is the real target var-decl of VAR that gets removed from
> lipo's symtab thus calling real_var_pool_node later will trigger
> gcc_assert. This fix just moved the assertion earlier?
>
No. There is no assertion after the fix. readl_varpool_node will not assert
in this case --- the decl is still there. We just did not get the varpool
node (we get a NULL pointer).
The ICE in walk_tree() when we clone that NULL varpool node.
> It should be ok for now to just drop the debug expr if the var is
> static/global.
>
> David
>
> >
> > --
> > This patch is available for review at
http://codereview.appspot.com/9760043
Issue 9760043: [google gcc-4_8] not mapping debug expr to a deleted varpool node
Created 10 years, 11 months ago by xur
Modified 10 years, 11 months ago
Reviewers: davidxl
Base URL: svn+ssh://gcc.gnu.org/svn/gcc/branches/google/gcc-4_8/
Comments: 0