[GHC] #10965: GHC Panic on import with 'OPTIONS_GHC -fobject-code -O'
GHC
ghc-devs at haskell.org
Fri Feb 12 01:45:38 UTC 2016
#10965: GHC Panic on import with 'OPTIONS_GHC -fobject-code -O'
---------------------------------+--------------------------------------
Reporter: Orome | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1-rc2
Resolution: | Keywords:
Operating System: MacOS X | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #10549 | Differential Rev(s):
Wiki Page: |
---------------------------------+--------------------------------------
Comment (by rwbarton):
The contents of the module aren't relevant, this module exhibits the same
panic.
{{{
{-# OPTIONS_GHC -fobject-code -O #-}
f :: String -> String
f = id
}}}
The difference is that this module has `-fobject-code`. `checkOptLevel`
disallows `-O`, if the target is `HscInterpreted`. That was the fix for
#10549. But here the target is `HscAsm`.
But somewhere later the target must get set to `HscInterpreted`, as
evidenced by the output
{{{
[1 of 1] Compiling Main ( G.hs, interpreted )
}}}
and the fact that the module contains breakpoints. (So as another issue,
`{-# OPTIONS_GHC -fobject-code #-}` doesn't actually work. Seems it hasn't
worked since at least 7.8.)
Aha, found it!
{{{
upsweep_mod hsc_env old_hpt (stable_obj, stable_bco) summary mod_index
nmods
= ...
-- We're using the dflags for this module now, obtained by
-- applying any options in its LANGUAGE & OPTIONS_GHC pragmas.
dflags = ms_hspp_opts summary
prevailing_target = hscTarget (hsc_dflags hsc_env)
local_target = hscTarget dflags
-- If OPTIONS_GHC contains -fasm or -fllvm, be careful that
-- we don't do anything dodgy: these should only work to
change
-- from -fllvm to -fasm and vice-versa, otherwise we could
-- end up trying to link object code to byte code.
target = if prevailing_target /= local_target
&& (not (isObjectTarget prevailing_target)
|| not (isObjectTarget local_target))
then prevailing_target
else local_target
-- store the corrected hscTarget into the summary
summary' = summary{ ms_hspp_opts = dflags { hscTarget = target
} }
...
}}}
Assuming this stuff about linking object code and byte code is still
relevant, I guess we should call `checkNewDynFlags` on `dflags { hscTarget
= target }`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10965#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list