Bug 5408 – Calling GC.malloc inside a unittest with a flag of 1 results in an access violation.
Status
RESOLVED
Resolution
WORKSFORME
Severity
blocker
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-01-03T22:46:00Z
Last change time
2012-02-10T21:47:50Z
Keywords
wrong-code
Assigned to
nobody
Creator
sandford
Comments
Comment #0 by sandford — 2011-01-03T22:46:08Z
In DMD 2.051 (and probably DMD 2.050 as well), calling GC.malloc with the 'has interior pointers' flag (i.e., 1) inside a unittest block causes an access violation error or a program crash.
This is a blocker for non-trivial use of the std.variant and std.json enhancements I'm working inside of unittests, including their own.
Test case:
import core.memory;
unittest {
GC.malloc(16, 0); // Okay
GC.malloc(16, 1); // object.Error: Access Violation
}
Comment #1 by andrej.mitrovich — 2012-01-21T16:29:26Z
Can't reproduce in 2.057 with `dmd -unittest test.d && test.exe`
Comment #2 by yebblies — 2012-02-10T21:47:50Z
Can't reproduce with dmd 2.058 beta. Please reopen if you can reproduce with a recent version of dmd.