Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Bug 81 - ICE in gimple_expand_cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Apr 8, 2015
1 parent f7faa9f commit 01f8851
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gcc/d/ChangeLog
@@ -1,5 +1,7 @@
2015-04-08 Iain Buclaw <ibuclaw@gdcproject.org>

* d-codegen.cc(get_decl_tree): Get correct non-local 'this' decl by
constructing component reference through parent link of nested classes.
* d-builtins.cc(DEF_FUNCTION_TYPE_VAR_8): Remove.
(DEF_FUNCTION_TYPE_VAR_12): Likewise.
(DEF_FUNCTION_TYPE_VAR_7, DEF_FUNCTION_TYPE_VAR_11): New macros.
Expand Down
23 changes: 23 additions & 0 deletions gcc/d/d-codegen.cc
Expand Up @@ -193,6 +193,29 @@ get_decl_tree (Declaration *decl, FuncDeclaration *func)

return component_ref (build_deref (frame_ref), vsym->SframeField);
}
else if (vd->parent != func && vd->isThisDeclaration() && func->isThis())
{
// Get the non-local 'this' value by going through parent link
// of nested classes.
AggregateDeclaration *ad = func->isThis();
tree this_tree = func->vthis->toSymbol()->Stree;

while (ad->isNested())
{
Dsymbol *outer = ad->toParent2();
tree vthis_field = ad->vthis->toSymbol()->Stree;
this_tree = component_ref (build_deref (this_tree), vthis_field);

ad = outer->isAggregateDeclaration();
if (ad == NULL)
{
gcc_assert (outer == vd->parent);
return this_tree;
}
}

gcc_unreachable();
}
}

// Static var or auto var that the back end will handle for us
Expand Down

0 comments on commit 01f8851

Please sign in to comment.