From 9d8d48378840b856eee47a4ad245537829ce5e5a Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Tue, 8 Mar 2022 09:50:53 +0000 Subject: 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]". --- compiler/GHC/CmmToC.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/GHC/CmmToC.hs') 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. -- cgit v1.2.1