Bug 17918 – [Reg 2.072] ICE with unknown symbol in base class

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-10-20T00:11:27Z
Last change time
2018-03-29T03:23:21Z
Keywords
ice, ice-on-invalid-code
Assigned to
No Owner
Creator
Roman

Attachments

IDFilenameSummaryContent-TypeSize
1663desktopfiletest.zipexample to replicate the issueapplication/zip3767

Comments

Comment #0 by freeslave93 — 2017-10-20T00:11:27Z
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.
Comment #6 by bugzilla — 2018-03-29T02:16:30Z
Comment #7 by github-bugzilla — 2018-03-29T03:23:20Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/352b70901d19ac173899e9d7d21aee60d43ed9be Fix issue 17918 - Stop if the late semantic pass fails No matter what the outcome of finishVtbl was the old code kept building the rest of the class. If the late semantic pass over the FunctionDeclaration fails we should abort the codegen phase instead of going on. https://github.com/dlang/dmd/commit/d17cde4f4d16274960ab0a55fa1dc4d2b1e0625f Merge pull request #8096 from LemonBoy/b17918 Fix issue 17918 - Stop if the late semantic pass fails merged-on-behalf-of: Walter Bright <[email protected]>