diff options
author | Cheng Shao <astrohavoc@gmail.com> | 2022-09-04 14:04:51 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-09-19 09:07:43 -0400 |
commit | 1e1ed8c5224a2a2d8ccf502da08a24ce71fd5ac6 (patch) | |
tree | 9b8601a2ca4f601999ad80867f3cfa77b644c135 /compiler | |
parent | c1f81b38625a5fea7fb8160a3a62ae6be078a7b1 (diff) | |
download | haskell-1e1ed8c5224a2a2d8ccf502da08a24ce71fd5ac6.tar.gz |
CmmToC: emit __builtin_unreachable() after noreturn ccalls
Emit a __builtin_unreachable() call after a foreign call marked as
CmmNeverReturns. This is crucial to generate correctly typed code for
wasm; as for other archs, this is also beneficial for the C compiler
optimizations.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/CmmToC.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/CmmToC.hs b/compiler/GHC/CmmToC.hs index 3608ac7033..6e5ac43ca6 100644 --- a/compiler/GHC/CmmToC.hs +++ b/compiler/GHC/CmmToC.hs @@ -251,7 +251,7 @@ pprStmt platform stmt = -- can't add the @n suffix ourselves, because -- it isn't valid C. | CmmNeverReturns <- ret -> - pprCall platform cast_fn cconv hresults hargs <> semi + pprCall platform cast_fn cconv hresults hargs <> semi <> text "__builtin_unreachable();" | not (isMathFun lbl) -> pprForeignCall platform (pprCLabel platform CStyle lbl) cconv hresults hargs _ -> |