diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
index ea5f716272ff9bc7164fa7fe3c0caf2a4ce3ca57..9165de9c247430b36a7275810983258521c6b227 100644
--- a/compiler/GHC/Driver/Pipeline.hs
+++ b/compiler/GHC/Driver/Pipeline.hs
@@ -850,18 +850,18 @@ llvmManglePipeline pipe_env hsc_env location llc_fn = do
       else use (T_LlvmMangle pipe_env hsc_env llc_fn)
   asPipeline False pipe_env hsc_env location mangled_fn
 
-cmmCppPipeline :: P m => PipeEnv -> HscEnv -> FilePath -> m FilePath
+cmmCppPipeline :: P m => PipeEnv -> HscEnv -> FilePath -> m (Maybe FilePath)
 cmmCppPipeline pipe_env hsc_env input_fn = do
   output_fn <- use (T_CmmCpp pipe_env hsc_env input_fn)
   cmmPipeline pipe_env hsc_env output_fn
 
-cmmPipeline :: P m => PipeEnv -> HscEnv -> FilePath -> m FilePath
+cmmPipeline :: P m => PipeEnv -> HscEnv -> FilePath -> m (Maybe FilePath)
 cmmPipeline pipe_env hsc_env input_fn = do
   (fos, output_fn) <- use (T_Cmm pipe_env hsc_env input_fn)
   mo_fn <- hscPostBackendPipeline pipe_env hsc_env HsSrcFile (backend (hsc_dflags hsc_env)) Nothing output_fn
   case mo_fn of
-    Nothing -> panic "CMM pipeline - produced no .o file"
-    Just mo_fn -> use (T_MergeForeign pipe_env hsc_env mo_fn fos)
+    Nothing -> return Nothing
+    Just mo_fn -> Just <$> use (T_MergeForeign pipe_env hsc_env mo_fn fos)
 
 jsPipeline :: P m => PipeEnv -> HscEnv -> Maybe ModLocation -> FilePath -> m FilePath
 jsPipeline pipe_env hsc_env location input_fn = do
@@ -938,8 +938,8 @@ pipelineStart pipe_env hsc_env input_fn mb_phase =
    fromPhase LlvmLlc    = llvmLlcPipeline pipe_env hsc_env Nothing input_fn
    fromPhase LlvmMangle = llvmManglePipeline pipe_env hsc_env Nothing input_fn
    fromPhase StopLn     = return (Just input_fn)
-   fromPhase CmmCpp     = Just <$> cmmCppPipeline pipe_env hsc_env input_fn
-   fromPhase Cmm        = Just <$> cmmPipeline pipe_env hsc_env input_fn
+   fromPhase CmmCpp     = cmmCppPipeline pipe_env hsc_env input_fn
+   fromPhase Cmm        = cmmPipeline pipe_env hsc_env input_fn
    fromPhase Js         = Just <$> foreignJsPipeline pipe_env hsc_env Nothing input_fn
    fromPhase MergeForeign = panic "fromPhase: MergeForeign"
 
diff --git a/testsuite/tests/cmm/should_compile/Makefile b/testsuite/tests/cmm/should_compile/Makefile
index 6ee7fae2e052cd8c7b6f1890e23611d834319db6..22aa0a0fc11492a8f7e326ef974a1e15676f9fb3 100644
--- a/testsuite/tests/cmm/should_compile/Makefile
+++ b/testsuite/tests/cmm/should_compile/Makefile
@@ -13,3 +13,6 @@ T16930:
 	grep -rl "after setInfoTableStackMap" `ls T16930.*`
 	grep -rl "Layout Stack" `ls T16930.*`
 	grep -rl "Post switch plan" `ls T16930.*`
+
+T23610:
+	'$(TEST_HC)' $(TEST_HC_OPTS) T23610.cmm -S
diff --git a/testsuite/tests/cmm/should_compile/T23610.cmm b/testsuite/tests/cmm/should_compile/T23610.cmm
new file mode 100644
index 0000000000000000000000000000000000000000..1484549d9c74fb42cc40813ea4bf77c7579681b8
--- /dev/null
+++ b/testsuite/tests/cmm/should_compile/T23610.cmm
@@ -0,0 +1,3 @@
+test(bits64 x) {
+    return (x);
+}
diff --git a/testsuite/tests/cmm/should_compile/all.T b/testsuite/tests/cmm/should_compile/all.T
index 7f401591627acd8e5f613679a7fd36ff11ac5d35..512e2bf6f8ed2b7df98b99a81ab99bdc3c670b71 100644
--- a/testsuite/tests/cmm/should_compile/all.T
+++ b/testsuite/tests/cmm/should_compile/all.T
@@ -8,3 +8,4 @@ test('cmm_sink_sp', [ only_ways(['optasm']), grep_errmsg(r'(\[Sp.*\]).*(=).*(\[.
 test('T16930', normal, makefile_test, ['T16930'])
 test('T17442', normal, compile, [''])
 test('T20725', normal, compile, ['-package ghc'])
+test('T23610', normal, makefile_test, ['T23610'])