Bug 19290 – immutable associative array corruption with -m64 and MinGW

Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2018-10-07T16:47:58Z
Last change time
2019-01-02T07:13:54Z
Assigned to
No Owner
Creator
Basile-z

Comments

Comment #0 by b2.temp — 2018-10-07T16:47:58Z
It seems that a kind of corruption happens in dparse when it's compiled with -m64, lld linker and MinGW. To reproduce save this code in a bat and run it from a console: ``` git clone https://github.com/dlang-community/libdparse.git git clone https://github.com/dlang-community/stdx-allocator.git cd libdparse git checkout v0.9.9 cd .. dmd main.d ^ libdparse\src\std\experimental\lexer.d ^ libdparse\src\dparse\ast.d ^ libdparse\src\dparse\lexer.d ^ libdparse\src\dparse\parser.d ^ libdparse\src\dparse\rollback_allocator.d ^ libdparse\src\dparse\stack_buffer.d ^ stdx-allocator\source\stdx\allocator\package.d ^ stdx-allocator\source\stdx\allocator\mallocator.d ^ stdx-allocator\source\stdx\allocator\gc_allocator.d ^ -Ilibdparse\src -Istdx-allocator\source -m64 -debug main.exe ``` Which gives a range error that didn't happen when using -m32, here : https://github.com/dlang-community/libdparse/blob/95444a966923a24098c31464e09a7096208da155/src/dparse/ast.d#L88 This really shouldn't happen since each possible entry is setup in a static module constructor just above. The problem doesn't happen if the involved assoc array is not immutable, which will be used as workaround for now. (test case wont be affected)
Comment #1 by b2.temp — 2018-10-07T16:48:55Z
main.d for the reproduction ``` void main() { import dparse.parser, dparse.ast, dparse.lexer, dparse.rollback_allocator; import std.file; class Visitor : ASTVisitor {} LexerConfig config; StringCache cache = StringCache(16); RollbackAllocator rba; auto src = readText(r"libdparse\src\dparse\parser.d"); auto tok = getTokensForParser(src, config, &cache); auto mod = parseModule(tok, "stdin", &rba); auto vis = new Visitor; vis.visit(mod); } ```
Comment #2 by b2.temp — 2019-01-02T07:13:54Z
problem is gone since DMD 2.084