www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20048] New: [Windows] Program segfaults when running tests

https://issues.dlang.org/show_bug.cgi?id=20048

          Issue ID: 20048
           Summary: [Windows] Program segfaults when running tests
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

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/bwjvtywkiklrkpgiduap forum.dlang.org --
Jul 13 2019