Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 108 - ICE using @attribute("forceinline")
Summary: ICE using @attribute("forceinline")
Status: RESOLVED FIXED
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 4.8.x
Hardware: All All
: --- major
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2014-03-16 04:50 CET by Mike
Modified: 2014-03-16 11:06 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike 2014-03-16 04:50:10 CET
* 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
Comment 1 Mike 2014-03-16 09:14:43 CET
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'
Comment 2 Iain Buclaw 2014-03-16 09:56:57 CET
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;