[Issue 13861] New: compiler segfault with nested struct, cannot access frame

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Dec 14 04:04:35 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13861

          Issue ID: 13861
           Summary: compiler segfault with nested struct, cannot access
                    frame
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: vlevenfeld at gmail.com

This code does not compile:

struct Foo (alias f, T)
{
    void bar () {} // BUG if not commented out, I get "Error: cannot access
frame pointer of test.N.Foo!((n) => n, ulong).Foo"
}

void main () {
    auto A = N;
    typeof (A) x;
}

static N () {return Foo!(n => n, size_t)();}

In addition, when I attempt to use the value of A instead of just taking the
typeof, I get a compiler segfault. Here is the backtrace:

#0  0x000000000054637c in FuncDeclaration::hasNestedFrameRefs (this=0x0)
    at func.c:4182
#1  0x000000000058ae1d in getEthis (loc=..., irs=0x7fffffffded0, 
    fd=0x7ffff512a0c0) at toir.c:219
#2  0x000000000058b0f9 in setEthis (loc=..., irs=0x7fffffffded0, ey=0x1ec6298, 
    ad=0x7ffff1bff500) at toir.c:300
#3  0x00000000005848cb in ToElemVisitor::visit (this=0x7fffffffd9c0, 
    sle=0x7ffff084c6c0) at e2ir.c:5220
#4  0x000000000053737a in StructLiteralExp::accept (this=0x7ffff084c6c0, 
    v=0x7fffffffd9c0) at expression.h:493
#5  0x00000000005849f7 in toElem (e=0x7ffff084c6c0, irs=0x7fffffffded0)
    at e2ir.c:5247
#6  0x000000000057fc2e in ToElemVisitor::visit (this=0x7fffffffdb20, 
    ce=0x7ffff084c820) at e2ir.c:3435
#7  0x0000000000537948 in CallExp::accept (this=0x7ffff084c820, 
    v=0x7fffffffdb20) at expression.h:908
#8  0x00000000005849f7 in toElem (e=0x7ffff084c820, irs=0x7fffffffded0)
    at e2ir.c:5247
#9  0x0000000000584cee in toElemDtor (e=0x7ffff084c820, irs=0x7fffffffded0)
    at e2ir.c:5340
#10 0x00000000005732cf in S2irVisitor::visit (this=0x7fffffffdcb0, 
    s=0x7ffff0832d00) at s2ir.c:770
#11 0x00000000004655b6 in ReturnStatement::accept (this=0x7ffff0832d00, 
#12 0x00000000005716ab in Statement_toIR (s=0x7ffff0832d00, irs=0x7fffffffded0)
    at s2ir.c:1273
#13 0x0000000000573644 in S2irVisitor::visit (this=0x7fffffffdd40, 
    s=0x7ffff0833a90) at s2ir.c:850
#14 0x0000000000465176 in CompoundStatement::accept (this=0x7ffff0833a90, 
    v=0x7fffffffdd40) at statement.h:206
#15 0x00000000005716ab in Statement_toIR (s=0x7ffff0833a90, irs=0x7fffffffded0)
    at s2ir.c:1273
#16 0x0000000000573644 in S2irVisitor::visit (this=0x7fffffffddd0, 
    s=0x7ffff088aca0) at s2ir.c:850
#17 0x0000000000465176 in CompoundStatement::accept (this=0x7ffff088aca0, 
    v=0x7fffffffddd0) at statement.h:206
#18 0x00000000005716ab in Statement_toIR (s=0x7ffff088aca0, irs=0x7fffffffded0)
    at s2ir.c:1273
#19 0x000000000056fc62 in FuncDeclaration::toObjFile (this=0x7ffff082ca70, 
    multiobj=false) at glue.c:1222
#20 0x00000000005899c8 in TemplateInstance::toObjFile (this=0x7ffff082c5e0, 
    multiobj=false) at toobj.c:1168
#21 0x000000000056e040 in Module::genobjfile (this=0x7ffff7ee1600, 
    multiobj=false) at glue.c:383
#22 0x0000000000406757 in tryMain (argc=6, argv=0x7295b0) at mars.c:1697
#23 0x0000000000406c84 in main (argc=2, argv=0x7fffffffe848) at mars.c:1782

--


More information about the Digitalmars-d-bugs mailing list