December 29, 2012
http://gdcproject.org/bugzilla/show_bug.cgi?id=31

             Bug #: 31
           Summary: ICE in getVThis
    Classification: Unclassified
           Product: GDC
           Version: development
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
        AssignedTo: ibuclaw@gdcproject.org
        ReportedBy: johannespfau@gmail.com


Created attachment 21
  --> http://gdcproject.org/bugzilla/attachment.cgi?id=21
reduced test case

I'm trying to get the unittest target in the libphobos makefile working again and I found some compiler bugs when compiling the phobos sources with -funittest.

Command line:
------------
/home/jpf/Dokumente/Code/gdc/objdir/./gcc/gdc -B/home/jpf/Dokumente/Code/gdc/objdir/./gcc/ -B/opt/gdc/x86_64-unknown-linux-gnu/bin/ -B/opt/gdc/x86_64-unknown-linux-gnu/lib/ -isystem /opt/gdc/x86_64-unknown-linux-gnu/include -isystem /opt/gdc/x86_64-unknown-linux-gnu/sys-include -o std/container.t.o -Wall -g -frelease -O2 -fversion=GC_Use_Alloc_MMap -fversion=GC_Use_Stack_GLibC -fversion=GC_Use_Data_Fixed -nostdinc -pipe -fdeprecated -fproperty -I ../../../gcc-4.8-20121021/libphobos -I ../../../gcc-4.8-20121021/libphobos/libdruntime -I ./libdruntime/x86_64-unknown-linux-gnu  -fno-release -funittest -c ../../../gcc-4.8-20121021/libphobos/std/container.d
------------

Compiler messages (for complete container.d):
-----------
../../../gcc-4.8-20121021/libphobos/std/container.d: In member function
'opSlice':
../../../gcc-4.8-20121021/libphobos/std/container.d:5144: internal compiler
error: in getVThis, at d/d-codegen.cc:3687
0x618e0f IRState::getVThis(Dsymbol*, Expression*)
    ../../gcc-4.8-20121021/gcc/d/d-codegen.cc:3687
0x624299 AssignExp::toElem(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:970
0x61523e IRState::emitLocalVar(VarDeclaration*, bool)
    ../../gcc-4.8-20121021/gcc/d/d-codegen.cc:139
0x626a8f DeclarationExp::toElem(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:1715
0x624c35 CommaExp::toElem(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:1050
0x617aa7 IRState::objectInstanceMethod(Expression*, FuncDeclaration*, Type*)
    ../../gcc-4.8-20121021/gcc/d/d-codegen.cc:1335
0x61cd3e IRState::call(Expression*, ArrayBase<Expression>*)
    ../../gcc-4.8-20121021/gcc/d/d-codegen.cc:2210
0x625d98 CallExp::toElem(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:1478
0x625e9f Expression::toElemDtor(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:1507
0x62b0ef ReturnStatement::toIR(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:3823
0x62ba88 CompoundStatement::toIR(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:4098
0x627960 FuncDeclaration::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:2676
0x5fe806 ClassDeclaration::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/dfrontend/toobj.c:400
0x5f20ee TemplateInstance::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/dfrontend/template.c:5951
0x5f20ee TemplateInstance::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/dfrontend/template.c:5936
0x628987 Module::genobjfile(int)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:2823
0x60ae95 d_parse_file()
    ../../gcc-4.8-20121021/gcc/d/d-lang.cc:1104
-----------

Compiler messages (reduced example)
-----------
test.reduced/std/container.d: In member function 'redBlackTree':
test.reduced/std/container.d:19: error: type RedBlackTree is not an expression
test.reduced/std/container.d: In member function 'opSlice':
test.reduced/std/container.d:13: internal compiler error: in getVThis, at
d/d-codegen.cc:3687
0x618e0f IRState::getVThis(Dsymbol*, Expression*)
    ../../gcc-4.8-20121021/gcc/d/d-codegen.cc:3687
0x62d8e5 StructLiteralExp::toElem(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:2335
0x625e9f Expression::toElemDtor(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:1507
0x62b0ef ReturnStatement::toIR(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:3823
0x62ba88 CompoundStatement::toIR(IRState*)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:4098
0x627960 FuncDeclaration::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:2676
0x5fe806 ClassDeclaration::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/dfrontend/toobj.c:400
0x5f20ee TemplateInstance::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/dfrontend/template.c:5951
0x5f20ee TemplateInstance::toObjFile(int)
    ../../gcc-4.8-20121021/gcc/d/dfrontend/template.c:5936
0x628987 Module::genobjfile(int)
    ../../gcc-4.8-20121021/gcc/d/d-glue.cc:2823
0x60ae95 d_parse_file()
    ../../gcc-4.8-20121021/gcc/d/d-lang.cc:1104
-----------

A minimal test case is attached. I'm not sure how useful it is as it's actually invalid code and triggers some other errors first, but the ICE is triggered nevertheless.

The original std/container.d file does not produce other errors than the ICE.

NOTE: This is probably the same bug as https://bitbucket.org/goshawk/gdc/issue/316/ice-in-redblacktree-unittest but the example posted there seems to work for me and the error occured in a different gdc file.

-- 
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all issue changes.