diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-12-16 12:00:27 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-12-16 12:00:40 -0500 |
commit | 222e99d9e6b24c17a67c07d24d05999701b83e96 (patch) | |
tree | 69ba371b80c93fac5f8f0ff88e2da9c286ffb0a9 | |
parent | 5bf344b7f4e1538fbc019896ae07ae3ec2a18207 (diff) | |
download | haskell-222e99d9e6b24c17a67c07d24d05999701b83e96.tar.gz |
Make up a module name for c-- files
Summary:
We used to pass a bottoming Module to the NCG, which resulted in panics
when `-v` was used due to debug output (see #11784). Instead we make up
a module name. This is a bit scary since `PIC.howToAccessLabel` might
actually use the Module, but if it wasn't crashing before I suppose it's
fine.
Test Plan: `touch hi.cmm; ghc -v2 -c -dcmm-lint hi.cmm`
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2864
GHC Trac Issues: #11784
-rw-r--r-- | compiler/main/HscMain.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 141f59f299..9a64794b77 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -1363,10 +1363,13 @@ hscCompileCmmFile hsc_env filename output_filename = runHsc hsc_env $ do dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose "Parsed Cmm" (ppr cmm) (_, cmmgroup) <- cmmPipeline hsc_env initTopSRT cmm rawCmms <- cmmToRawCmm dflags (Stream.yield cmmgroup) - _ <- codeOutput dflags no_mod output_filename no_loc NoStubs [] rawCmms + let -- Make up a module name to give the NCG. We can't pass bottom here + -- lest we reproduce #11784. + mod_name = mkModuleName $ "Cmm$" ++ FilePath.takeFileName filename + cmm_mod = mkModule (thisPackage dflags) mod_name + _ <- codeOutput dflags cmm_mod output_filename no_loc NoStubs [] rawCmms return () where - no_mod = panic "hscCompileCmmFile: no_mod" no_loc = ModLocation{ ml_hs_file = Just filename, ml_hi_file = panic "hscCompileCmmFile: no hi file", ml_obj_file = panic "hscCompileCmmFile: no obj file" } |