FWIW, I used the following to select WinIO by default:
diff --git a/rts/configure.ac b/rts/configure.acindex e9181aaf55..b85873e383 100644--- a/rts/configure.ac+++ b/rts/configure.ac@@ -401,10 +401,10 @@ dnl Now we establish a default I/O manager for the threaded and non-threaded dnl RTS. We select the default based on which I/O managers are enabled. They dnl are checked in reverse order of priority, the last enabled one wins: if test "$HostOS" = "mingw32"; then- GHC_IOMANAGER_DEFAULT_SELECT([IOManagerNonThreadedDefault], [winio], [EnableIOManagerWinIO],) GHC_IOMANAGER_DEFAULT_SELECT([IOManagerNonThreadedDefault], [win32-legacy], [EnableIOManagerWin32Legacy])- GHC_IOMANAGER_DEFAULT_SELECT([IOManagerThreadedDefault], [winio], [EnableIOManagerWinIO])+ GHC_IOMANAGER_DEFAULT_SELECT([IOManagerNonThreadedDefault], [winio], [EnableIOManagerWinIO],) GHC_IOMANAGER_DEFAULT_SELECT([IOManagerThreadedDefault], [mio], [EnableIOManagerMIO])+ GHC_IOMANAGER_DEFAULT_SELECT([IOManagerThreadedDefault], [winio], [EnableIOManagerWinIO]) else GHC_IOMANAGER_DEFAULT_SELECT([IOManagerNonThreadedDefault], [select], [EnableIOManagerSelect]) GHC_IOMANAGER_DEFAULT_SELECT([IOManagerThreadedDefault], [mio], [EnableIOManagerMIO])
The problem appears to be that ioMan (of type IOManagerState*) is NULL:
Thread 1 received signal SIGSEGV, Segmentation fault.0x00007ff668abc690 in AddIORequest (fd=fd@entry=2, forWriting=true, isSocket=false, len=len@entry=1, buffer=0x7ff4fd7f7010 "g", onCompletion=0x7ff668931cb0 <onIOComplete>) at rts\win32/MIOManager.c:446446 unsigned int reqID = ioMan->requestID++;(gdb) print ioMan$1 = (IOManagerState *) 0x0(gdb) bt#0 0x00007ff668abc690 in AddIORequest (fd=fd@entry=2, forWriting=true, isSocket=false, len=len@entry=1, buffer=0x7ff4fd7f7010 "g", onCompletion=0x7ff668931cb0 <onIOComplete>) at rts\win32/MIOManager.c:446#1 0x00007ff668931c9c in addIORequest (fd=2, forWriting=true, isSock=false, len=1, buf=0x7ff4fd7f7010 "g") at rts\win32/AsyncMIO.c:125#2 0x00007ff66803be8c in stg_asyncWritezh ()#3 0x0000000000000002 in ?? ()#4 0x00007ff667f11e88 in stg_marked_upd_frame_info ()#5 0x00007ff4fda04b08 in ?? ()#6 0x00007ff668d60501 in ghczminternal_GHCziInternalziMaybe_Nothing_closure ()#7 0x00007ff4fd7f7010 in ?? ()#8 0x006e00690000005c in ?? ()#9 0x0000000000000214 in ?? ()#10 0x000000000014db18 in ?? ()#11 0x0000000000120010 in ?? ()#12 0x000000000014db50 in ?? ()#13 0x0000000000000000 in ?? ()(gdb)
The stage2 ghc and indeed executables built with -threaded work fine so I suspect that something in !9676 (closed) may have broken WinIO in the non-threaded configuration.