summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Shao <astrohavoc@gmail.com>2022-03-08 09:50:53 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-11 20:00:01 -0500
commit9d8d48378840b856eee47a4ad245537829ce5e5a (patch)
tree892ff0b157566b573b7d16bb97490cfb2182b47c
parent1eee2e28ff51db0b8c2393d68f716c6c7941e779 (diff)
downloadhaskell-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.hs2
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.