* arm-none-eabi-gdc with ARM thumb support built 2014-03-16 from github 4.8 branch. * built using instructions on wiki (http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler) *********** Code to reproduce *********** import gcc.attribute; @attribute("forceinline") static void test() { trace.WriteLine("Here"); } void main() { test(); } *********** Output *********** internal compiler error: in build_attributes, at d/d-codegen.cc:867 0x638b43 build_attributes(Array<Expression>*) ../../gcc-4.8.2/gcc/d/d-codegen.cc:867 0x64297c setup_symbol_storage(Dsymbol*, tree_node*, bool) ../../gcc-4.8.2/gcc/d/d-objfile.cc:1833 0x637256 FuncDeclaration::toSymbol() ../../gcc-4.8.2/gcc/d/d-decls.cc:402 0x644901 FuncDeclaration::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:1159 0x641d7e AttribDeclaration::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:158 0x641d7e AttribDeclaration::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:158 0x641d7e AttribDeclaration::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:158 0x641d7e AttribDeclaration::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:158 0x641f46 TemplateInstance::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:890 0x64399e ClassDeclaration::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:239 0x641f46 TemplateInstance::toObjFile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:890 0x64631e Module::genobjfile(int) ../../gcc-4.8.2/gcc/d/d-objfile.cc:1510 0x6366b2 d_parse_file() ../../gcc-4.8.2/gcc/d/d-lang.cc:1125
The following test on Arch Linux 64 results in the same error. Changing platform attribute to 'All' ************* Code to reproduce ************** import std.stdio; import gcc.attribute; @attribute("forceinline") static void test() { writeln("here"); } void main() { test(); } gdc --version gdc (GCC) 4.8.2 20130725 (prerelease) compiled with simply 'gdc main.d'
Looks like the frontend devs changed the behaviours of optimize/interpret, again. This'll need adding to the testsuite to catch any future changes. *PATCH* diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index b0a50a4..a7acb92 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -830,8 +826,10 @@ build_attributes (Expressions *in_attrs) for (size_t i = 0; i < in_attrs->dim; i++) { Expression *attr = (*in_attrs)[i]->optimize (WANTexpand); - Dsymbol *sym = attr->type->toDsymbol (0); + if (attr->op == TOKcall) + attr = attr->ctfeInterpret(); + Dsymbol *sym = attr->type->toDsymbol (0); if (!sym) continue;
https://github.com/D-Programming-GDC/GDC/commit/b38af3d869fd7af5c83254febce92e5f39d796e6