Bug 17991 – ICE with imports without module

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-11-18T19:22:39Z
Last change time
2021-04-03T01:03:36Z
Keywords
ice, ice-on-valid-code, pull
Assigned to
No Owner
Creator
Temtaime

Comments

Comment #0 by temtaime — 2017-11-18T19:22:39Z
Use empty files: a/b/package.d a/b/c.d And one file: a/e/f.d import a.b, a.b.c; Then it will crash. If module a.b; and module a.b.c; are added to the files then it'll work
Comment #1 by razvan.nitu1305 — 2018-03-29T09:34:05Z
I cannot reproduce. Compiling on git HEAD (Ubuntu 16.04) from toplevel with the command: > dmd a/b/package.d a/b/c.d a/e/f.d Yields: a/e/f.d(2): Error: module `c` from file a/b/c.d must be imported with 'import c;' Modifying f.d to `import a.b, c;` results in successful compilation. Please close if you cannot reproduce.
Comment #2 by greensunny12 — 2018-04-04T06:04:59Z
The "good" news - I can reproduce this: mkdir -p a/b touch a/b/package.d touch a/b/c.d mkdir -p a/e touch a/e/f.d echo "import a.b, a.b.c;" > a/e/f.d dmddev a/e/f.d Here's the segfault: --- Program received signal SIGSEGV, Segmentation fault. 0x00005555557de19c in ScopeDsymbol::addAccessiblePackage(Package*, Prot) (this=0x7ffff7e9eba0, p=0x0, protection=...) at dmd/dsymbol.d:1491 1491 if (pary.length <= p.tag) #0 0x00005555557de19c in ScopeDsymbol::addAccessiblePackage(Package*, Prot) (this=0x7ffff7e9eba0, p=0x0, protection=...) at dmd/dsymbol.d:1491 #1 0x00005555557e4076 in DsymbolSemanticVisitor::visit(Import*) (this=0x7fffffffca40, imp=0x7ffff7e9f010) at dmd/dsymbolsem.d:1379 #2 0x00005555557b57c7 in Import::accept(Visitor*) (this=0x7ffff7e9f010, v=0x7fffffffca40) at dmd/dimport.d:309 #3 0x00005555557e0dd1 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7ffff7e9f010, sc=0x7ffff7e9f300) at dmd/dsymbolsem.d:343 #4 0x00005555557e5e7e in DsymbolSemanticVisitor::visit(Module*) (this=0x7fffffffcaf0, m=0x7ffff7e9eba0) at dmd/dsymbolsem.d:1916 #5 0x00005555557d0916 in Module::accept(Visitor*) (this=0x7ffff7e9eba0, v=0x7fffffffcaf0) at dmd/dmodule.d:1322 #6 0x00005555557e0dd1 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7ffff7e9eba0, sc=0x0) at dmd/dsymbolsem.d:343 #7 0x0000555555873175 in dmd.mars.tryMain(ulong, const(char)**) (argv=0x7fffffffd6a8, argc=2) at dmd/mars.d:804 #8 0x00005555558744c7 in D main () at dmd/mars.d:1098 --- ... and here an attempt to fix it: https://github.com/dlang/dmd/pull/8126
Comment #3 by github-bugzilla — 2018-04-10T16:38:56Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/bed9bf405d1e743e8a594185cd9f40f1b2db92ad Fix Issue 17991 - ICE with imports without module https://github.com/dlang/dmd/commit/9398ee965054f327d85e2229d679ac09d1272f00 Merge pull request #8126 from wilzbach/fix-17991 Fix Issue 17991 - ICE with imports without module merged-on-behalf-of: Razvan Nitu <[email protected]>
Comment #4 by dlang-bugzilla — 2019-12-18T16:45:45Z
*** Issue 20453 has been marked as a duplicate of this issue. ***
Comment #5 by dlang-bot — 2021-04-03T01:03:36Z
dlang/dmd pull request #12350 "[dmd-cxx] More fixes for package import visibility" was merged into dmd-cxx: - 06823ee5703fadb71991fd586d3d03067d8f6218 by Sebastian Wilzbach: [dmd-cxx] Fix Issue 17991 - ICE with imports without module https://github.com/dlang/dmd/pull/12350