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

Commit

Permalink
Merge pull request #231 from ibuclaw/bug239
Browse files Browse the repository at this point in the history
Bug 239: Fix ICE in Mangler::mangleFunc from lazy semantic run
  • Loading branch information
ibuclaw authored Sep 11, 2016
2 parents 1ad55ae + 1b33bba commit 96b60cb
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
6 changes: 6 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2016-09-11 Iain Buclaw <ibuclaw@gdcproject.org>

* d-decls.cc (FuncDeclaration::toSymbol): Save current module decl
before calling function semantic.
* d-objfile.cc (FuncDeclaration::toObjFile): Likewise.

2016-09-11 Iain Buclaw <ibuclaw@gdcproject.org>

* types.cc: Document and reformat file.
Expand Down
16 changes: 11 additions & 5 deletions gcc/d/d-decls.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// d-decls.cc -- D frontend for GCC.
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
// Copyright (C) 2011-2016 Free Software Foundation, Inc.

// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -291,11 +291,17 @@ FuncDeclaration::toSymbol()
tree vindex = NULL_TREE;

// Run full semantic on symbols we need to know about during compilation.
if (inferRetType && type && !type->nextOf() && !functionSemantic())
if (inferRetType && type && !type->nextOf())
{
csym = new Symbol();
csym->Stree = error_mark_node;
return csym;
Module *old_current_module_decl = current_module_decl;
current_module_decl = NULL;
if (!functionSemantic())
{
csym = new Symbol();
csym->Stree = error_mark_node;
return csym;
}
current_module_decl = old_current_module_decl;
}

// Use same symbol for FuncDeclaration templates with same mangle
Expand Down
5 changes: 4 additions & 1 deletion gcc/d/d-objfile.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// d-objfile.cc -- D frontend for GCC.
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
// Copyright (C) 2011-2016 Free Software Foundation, Inc.

// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -1153,8 +1153,11 @@ FuncDeclaration::toObjFile()
// Ensure all semantic passes have ran.
if (semanticRun < PASSsemantic3)
{
Module *old_current_module_decl = current_module_decl;
current_module_decl = NULL;
functionSemantic3();
Module::runDeferredSemantic3();
current_module_decl = old_current_module_decl;
}

if (global.errors)
Expand Down
8 changes: 8 additions & 0 deletions gcc/testsuite/gdc.test/compilable/gdc239.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// PERMUTE_ARGS:

import imports.gdc239a;

class C239
{
C239a *foo;
}
9 changes: 9 additions & 0 deletions gcc/testsuite/gdc.test/compilable/imports/gdc239a.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import std.path : buildNormalizedPath;

class C239a
{
auto bar()
{
auto path = buildNormalizedPath("/", "foo");
}
}

0 comments on commit 96b60cb

Please sign in to comment.