diff options
author | Cheng Shao <astrohavoc@gmail.com> | 2022-03-08 09:50:53 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-11 20:00:01 -0500 |
commit | 9d8d48378840b856eee47a4ad245537829ce5e5a (patch) | |
tree | 892ff0b157566b573b7d16bb97490cfb2182b47c | |
parent | 1eee2e28ff51db0b8c2393d68f716c6c7941e779 (diff) | |
download | haskell-9d8d48378840b856eee47a4ad245537829ce5e5a.tar.gz |
CmmToC: emit __builtin_unreachable() when CmmSwitch doesn't contain fallback case
Otherwise the C compiler may complain "warning: non-void function does
not return a value in all control paths [-Wreturn-type]".
-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 a8fa7ef6cb..80e4c8fd60 100644 --- a/compiler/GHC/CmmToC.hs +++ b/compiler/GHC/CmmToC.hs @@ -357,7 +357,7 @@ pprSwitch platform e ids caseify (_ , _ ) = panic "pprSwitch: switch with no cases!" def | Just l <- mbdef = text "default: goto" <+> pprBlockId l <> semi - | otherwise = empty + | otherwise = text "default: __builtin_unreachable();" -- --------------------------------------------------------------------- -- Expressions. |