Access violations when combining asynchronous exceptions with `unsafePerformIO`
## Summary
While looking into other things I found this example program which (unexpectedly) segfaults:
```
{-# OPTIONS_GHC -ddump-simpl -fno-full-laziness -ddump-to-file #-}
{-# OPTIONS_GHC -O -fno-full-laziness #-}
import Control.Concurrent (threadDelay, myThreadId, forkIO, killThread)
import System.IO.Unsafe (unsafePerformIO)
import Control.Exception
import GHC.Exts
compute :: Int
compute = noinline unsafePerformIO $ do
mainThreadID <- myThreadId
_ <- forkIO $ do
threadDelay 500000
killThread mainThreadID
threadDelay 1000000
return 0
main = do
catch (print compute) (\(e :: AsyncException) -> print $ "1:" ++ show e)
catch (print compute) (\(e :: AsyncException) -> print $ "2:" ++ show e)
print "done"
```
```
$ ~/repos/ghc_head/_build/stage1/bin/ghc Main.hs -fforce-recomp && ./Main.exe
[1 of 2] Compiling Main ( Main.hs, Main.o )
[2 of 2] Linking Main.exe [Objects changed]
"1:"
Access violation in generated code when reading 0x7ff
Attempting to reconstruct a stack trace...
Frame Code address
* 0x2ba9b9d330 0x7ffb0cb0c37d C:\windows\SYSTEM32\ntdll.dll+0x3c37d
* 0x2ba9b9d370 0x7ffb0cb0b001 C:\windows\SYSTEM32\ntdll.dll+0x3b001
* 0x2ba9b9d3a0 0x7ffb0a5e364b C:\windows\System32\ucrtbase.dll+0x1364b
* 0x2ba9b9d3a8 0x7ff620ad7bde C:\Users\andi\tmp\hs\unsafe\Main.exe+0x67bde
* 0x2ba9b9d3b0 0x1
* 0x2ba9b9d3b8 0x7ff600000000
* 0x2ba9b9d3c0 0x7ff620f821e8 C:\Users\andi\tmp\hs\unsafe\Main.exe+0x5121e8
* 0x2ba9b9d3c8 0x7ff620fb35f2 C:\Users\andi\tmp\hs\unsafe\Main.exe+0x5435f2
* 0x2ba9b9d3d0 0x7ff4ed1fd010
```
## Expected behavior
I have not thought about what exactly the expected behaviour here is, but I'm sure a segfault is not it.
## Environment
* GHC version used:
Optional:
* Operating System:
* System Architecture:
issue