Created attachment 1663
example to replicate the issue
Getting segfault when running unittests for my desktopfile package with dub.
I've created minimum example, cutting most unneeeded stuff, to replicate the issue. See an attachment.
Go to desktopfile directory and add override for inilike with dub:
dub add-override inilike 1.0.1 ../inilike
Then run tests as usual:
dub test
DMD64 D Compiler v2.076.1
DUB version 1.5.0, built on Oct 9 2017
Comment #1 by freeslave93 — 2017-10-20T10:53:27Z
Note that there's another error that precedes the crash
../inilike/source/inilike/file.d(185,33): Error: no property 'map' for type 'ByNode!(Node)'
[../inilike/source/inilike/file.d(183,19)] byNode _error_
While import std.algorithm : map is clearly here.
There's another function that has the same import, byEntry. If I move such import into the scope available for both functions there's no error.
Comment #2 by bugzilla — 2017-10-24T10:32:14Z
> Getting segfault when running unittests
But the topic of this issue is dmd itself seg faulting. Please clarify.
Comment #3 by bugzilla — 2017-10-24T10:33:11Z
Also, why is this marked as a regression? What dmd did it work with before?
Comment #4 by freeslave93 — 2017-10-24T12:40:59Z
I meant building.
It's just for dub running and building are done with one command.
I marked it as a regression because it's quite old code and I did not have problems with it before.
I made this test in travis to check what compiler version introduced the regression: https://travis-ci.org/FreeSlave/travis-dmd-segfault-test
Note that I change desktopfile/dub.json so it depends on strict inilike version to avoid dub downloading the newer versions where I bypassed the bug.
Comment #5 by code — 2017-10-26T15:13:28Z
cat > a.d << CODE
class Base
{
auto byNode()
{
return _listMap;
}
}
CODE
cat > b.d << CODE
import a;
class Derived : Base
{
}
CODE
dmd -c b.d
----
a.d(5): Error: undefined identifier _listMap
Segmentation fault
----
#0 0x00000000007280f5 in totym(Type*) ()
#1 0x00000000007231c8 in ToCtypeVisitor::visit(Type*) ()
#2 0x00000000007018ea in Visitor::visit(TypeError*) ()
#3 0x0000000000698949 in TypeError::accept(Visitor*) ()
#4 0x000000000072df3a in toSymbol::ToSymbol::visit(FuncDeclaration*) ()
#5 0x000000000062b5b9 in FuncDeclaration::accept(Visitor*) ()
#6 0x000000000072d46f in toSymbol(Dsymbol*) ()
#7 0x0000000000736cd2 in toObjFile::ToObjFile::visit(ClassDeclaration*) ()
#8 0x000000000056c30d in ClassDeclaration::accept(Visitor*) ()
#9 0x0000000000735e23 in toObjFile(Dsymbol*, bool) ()
#10 0x000000000072527f in genObjFile(Module*, bool) ()
#11 0x000000000068c371 in ddmd.mars.tryMain(ulong, const(char)**) ()
#12 0x000000000068cdaf in D main ()
----
Changed severity from regression to major as this was always an ICE.
The difference between version in the example from comment 4, comes from map no longer being importable from std.algorithm.