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

Commit

Permalink
Bug 142 - ICE, FuncDeclaration::ctfeCompile
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jul 21, 2014
1 parent 2b3286e commit db6e514
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions gcc/d/ChangeLog
@@ -1,3 +1,9 @@
2014-07-21 Iain Buclaw <ibuclaw@gdcproject.org>

* d-objfile.cc(output_declaration_p): Don't emit any declarations from
the gcc.attribute module.
(StructDeclaration::toObjFile): Call output_declaration_p.

2014-07-17 Iain Buclaw <ibuclaw@gdcproject.org>

* d-lang.cc(d_init_options_struct): Set flag_wrapv as on by default.
Expand Down
30 changes: 23 additions & 7 deletions gcc/d/d-objfile.cc
Expand Up @@ -34,6 +34,7 @@ static FuncDeclaration *build_call_function (const char *, vec<FuncDeclaration *
static Symbol *build_ctor_function (const char *, vec<FuncDeclaration *>, vec<VarDeclaration *>);
static Symbol *build_dtor_function (const char *, vec<FuncDeclaration *>);
static Symbol *build_unittest_function (const char *, vec<FuncDeclaration *>);
static bool output_declaration_p (Dsymbol *dsym);

// Module info. Assuming only one module per run of the compiler.
ModuleInfo *current_module_info;
Expand Down Expand Up @@ -184,6 +185,9 @@ StructDeclaration::toObjFile (int)
if (isAnonymous() || !members)
return;

if (!output_declaration_p (this))
return;

if (global.params.symdebug)
toDebug();

Expand Down Expand Up @@ -1026,18 +1030,30 @@ Module::genmoduleinfo()
// Returns true if we want to compile the declaration DSYM.

static bool
output_declaration_p (Declaration *dsym)
output_declaration_p (Dsymbol *dsym)
{
// If errors occurred compiling it.
Type *t = dsym->type;
if (dsym->isDeclaration())
{
Type *t = ((Declaration *) dsym)->type;

if (t->ty == Terror)
return false;
if (t->ty == Terror)
return false;

if (t->ty == Tfunction)
{
TypeFunction *tf = (TypeFunction *) t;
if (tf->next == NULL || tf->next->ty == Terror)
return false;
}
}

if (t->ty == Tfunction)
// Don't emit any symbols from gcc.attribute module.
ModuleDeclaration *md = dsym->getModule()->md;
if (md && md->packages && md->packages->dim == 1)
{
TypeFunction *tf = (TypeFunction *) t;
if (tf->next == NULL || tf->next->ty == Terror)
if (!strcmp ((*md->packages)[0]->string, "gcc")
&& !strcmp (md->id->string, "attribute"))
return false;
}

Expand Down

0 comments on commit db6e514

Please sign in to comment.