D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6062 - segv in dmd/64 with assoc array literals
Summary: segv in dmd/64 with assoc array literals
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 critical
Assignee: No Owner
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-05-26 22:54 UTC by Brad Roberts
Modified: 2011-09-14 16:47 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Brad Roberts 2011-05-26 22:54:21 UTC
module bug;

void blah(int[char] as)
{
    //auto k = as;
    auto k = [6: as];
}

$ dmd -v -m64 -c bug.d

The first auto line, if enabled, compiles just fine.  The second doesn't.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000568525 in TemplateInstance::semantic (this=0x8cca90, sc=0x0, fargs=0x0) at template.c:3764
3764        tinst = sc->tinst;
(gdb) bt
#0  0x0000000000568525 in TemplateInstance::semantic (this=0x8cca90, sc=0x0, fargs=0x0) at template.c:3764
#1  0x00000000005684b4 in TemplateInstance::semantic (this=0x8cca90, sc=0x0) at template.c:3734
#2  0x00000000005129c5 in TypeAArray::getImpl (this=0x8683b0) at mtype.c:4062
#3  0x00000000005777a2 in TypeInfoAssociativeArrayDeclaration::toDt (this=0x8cc320, pdt=0x866270) at typinf.c:428
#4  0x000000000057887c in TypeInfoDeclaration::toObjFile (this=0x8cc320, multiobj=0) at typinf.c:750
#5  0x00000000005767b4 in Type::getTypeInfo (this=0x8683b0, sc=0x0) at typinf.c:147
#6  0x00000000005776f7 in TypeInfoAssociativeArrayDeclaration::toDt (this=0x8cc090, pdt=0x865a80) at typinf.c:421
#7  0x000000000057887c in TypeInfoDeclaration::toObjFile (this=0x8cc090, multiobj=0) at typinf.c:750
#8  0x00000000005767b4 in Type::getTypeInfo (this=0x8c89a0, sc=0x0) at typinf.c:147
#9  0x0000000000487bbf in AssocArrayLiteralExp::toElem (this=0x8c8880, irs=0x7fffffffda00) at e2ir.c:4843
#10 0x000000000047fbce in BinExp::toElemBin (this=0x8c8b00, irs=0x7fffffffda00, op=54) at e2ir.c:2076
#11 0x00000000004829fe in AssignExp::toElem (this=0x8c8b00, irs=0x7fffffffda00) at e2ir.c:2989
#12 0x000000000047ccba in Dsymbol_toElem (s=0x868940, irs=0x7fffffffda00) at e2ir.c:1170
#13 0x000000000047d091 in DeclarationExp::toElem (this=0x868a70, irs=0x7fffffffda00) at e2ir.c:1234
#14 0x000000000047befc in Expression::toElemDtor (this=0x868a70, irs=0x7fffffffda00) at e2ir.c:700
#15 0x00000000005446fa in ExpStatement::toIR (this=0x868a40, irs=0x7fffffffda00) at s2ir.c:1314
#16 0x000000000054478f in CompoundStatement::toIR (this=0x8c8b80, irs=0x7fffffffda00) at s2ir.c:1330
#17 0x00000000004e248a in FuncDeclaration::toObjFile (this=0x868540, multiobj=0) at glue.c:928
#18 0x00000000004e09a9 in Module::genobjfile (this=0x8679d0, multiobj=0) at glue.c:279
#19 0x000000000050488e in main (argc=11, argv=0x858600) at mars.c:1317

When fixed, the block in dmd's compilable/interpret3.d that's versioned out to just run on x86/32 should be changed to run on all platforms.  See also this commit:

https://github.com/D-Programming-Language/dmd/commit/2f85bab42d4b6d5c90e2a6d0d0b3b88ae0563f9a
Comment 1 yebblies 2011-09-14 06:43:27 UTC
Not specific to x86-64, caused by the new druntime interface's use of ExpressionsToStaticArray, and re-calling TypeAArray::semantic with no scope.

https://github.com/D-Programming-Language/dmd/pull/381