Skip to content

GHC-8.8.3 Access Violation, possibly because of recent update to Windows 10 2004

Summary

I reinstalled Windows recently, and installed GHC using stack. I have GHC-8.6.5 and GHC-8.8.3 installed, while GHC-8.6.5 works perfectly well, GHC-8.8.3 prints "Access Violation" for even a simple test program (main = putStrLn "hello, world").

Steps to reproduce

  1. Install GHC-8.8.3 using stack
  2. Write main = putStrLn "hello, world" to test.hs
  3. Run stack ghc test.hs (or simply ghc test.hs when ghc.exe is in PATH)
  4. The following error message produced (seems GHC accidentally accessed a null pointer):
[1 of 1] Compiling Main             ( test.hs, test.o )

Access violation in generated code when writing 0x0

 Attempting to reconstruct a stack trace...

   Frame        Code address
 * 0x461da80    0x37f7b66 C:\Users\krant\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x33f7b66
 * 0x461da88    0x3277bb9 C:\Users\krant\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x2e77bb9
 * 0x461da90    0x3
 * 0x461da98    0x76082f9
 * 0x461daa0    0x3d80c90 C:\Users\krant\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\bin\ghc.exe+0x3980c90
 * 0x461daa8    0x7c15a40

Expected behavior

The program compiles normally.

Environment

  • GHC version used: 8.8.3

Optional:

  • Operating System: Windows 2004 (Internal version 19041.388)
  • System Architecture: x86-64

More Details

  • I have my previously-installed GHC elsewhere on my hard drive, so I tested with that (by manually add it to PATH and use it), and get the same error message.
  • I reinstalled Windows, thus Windows version got updated from 1907 to 2004. I suspect the problem is rooted here.
  • GHC-8.6.5 compiles the same test.hs with no trouble.
  • I recall that -fexternal-interpreter fixes a similar crash, but it does not help in this case.
  • GHCi/runghc works well on the same test.hs.
Edited by Xie Ruifeng
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information