Bug 20048 – [Windows] Program segfaults when running tests
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2019-07-13T16:39:02Z
Last change time
2019-07-14T11:36:07Z
Keywords
pull
Assigned to
No Owner
Creator
JR
Comments
Comment #0 by zorael — 2019-07-13T16:39:02Z
Windows 10 64-bit, dmd 2.087.0.
When I try to unit test the wintestcrash branch at https://github.com/zorael/tests/tree/wintestcrash, the program exits "with code -1073741819". There's nothing in the code that would explain it, it's just a few lines (with one dub depdendency) that should assert[1].
> git clone https://github.com/zorael/tests -b wintestcrash
> cd tests
> dub test
[...]
> Running .\test.exe
> Program exited with code -1073741819
Beyond occuring on AppVeyor it was reproduced by Boris Carvajal in the NG thread[2].
> I can reproduce it on Win10/x64 (qemu).
> But it's really hard to debug on windows (at least with dmd and
> no V.Studio), I could only get a readable backtrace with
> "WinDbg Preview" debugger:
>
> [0x0] msvcr100!_output_l + 0x41e
> [0x1] msvcr100!printf + 0x7c
> [0x2] test!int
> core.runtime.runModuleUnitTests().__foreachbody1(object.ModuleInfo*) + 0xd1
> [0x3] test!int object.ModuleInfo.opApply(scope int
> delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*)) + 0x27
> [0x4] test!int rt.minfo.moduleinfos_apply(scope int
> delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref
> rt.sections_win64.SectionGroup) + 0x54
> [0x5] test!int rt.minfo.moduleinfos_apply(scope int
> delegate(immutable(object.ModuleInfo*))) + 0x1f
> [0x6] test!int object.ModuleInfo.opApply(scope int
> delegate(object.ModuleInfo*)) + 0x27
> [0x7] test!runModuleUnitTests + 0xfe
> ...
> msvcr100!_output_l+0x41e:
> 00000000`62e0346e 443811 cmp byte ptr [rcx],r10b
> ds:00000000`00000010=??
> Registers are: rcx = 0x0000000000000010, r10 =
> 0x0000000000000000
> it seems like ( str[i] == '\0')
>
> So the program try to print from an invalid pointer and the
> StackTrace/Throwable object is somewhat related.
[1]: https://github.com/zorael/tests/blob/ef00a257/source/app.d
[2]: https://forum.dlang.org/post/[email protected]
Comment #1 by dlang-bot — 2019-07-14T08:28:01Z
@BorisCarvajal created dlang/druntime pull request #2675 "Fix issue 20048: Unittest printing fails on Windows when using msvcr100.dll" fixing this issue:
- Fix issue 20048: Unittest printing fails on Windows when using msvcr100.dll
https://github.com/dlang/druntime/pull/2675
Comment #2 by dlang-bot — 2019-07-14T11:36:07Z
dlang/druntime pull request #2675 "Fix issue 20048: Unittest printing fails on Windows when using msvcr100.dll" was merged into stable:
- e0aaac6f227e15908f8ad49a6e4024ee7fbc2582 by Boris Carvajal:
Fix issue 20048: Unittest printing fails on Windows when using msvcr100.dll
https://github.com/dlang/druntime/pull/2675