
#14285: Entered absent arg - triggered by INLINEABLE, regression from 8.0.2
---------------------------------+--------------------------------------
Reporter: j.waldmann | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
---------------------------------+--------------------------------------
Comment (by simonpj):
I know what is going on. It's extremely annoying. In module `Foo` we get
this after demand analysis:
{{{
pre_images [InlPrag=INLINABLE] :: forall a k k. Enum a => a -> Rel k k ->
Set k
[Str=
, <----------- NB
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 0 20] 120 0
Tmpl= \ (@ a_a52c) (@ k_a52e) (@ k_a52d)
($dEnum_a52n [Occ=Once] :: Enum a_a52c)
(x_a2k0 [Occ=Once] :: a_a52c)
(rel_a2k1 [Occ=Once!] :: Rel k_a52e k_a52d) ->
case rel_a2k1 of { Rel f_a2k2 [Occ=Once] g_a2k3
[Occ=Once] ->
NB -------> case T14285a.$WRel @ k_a52d @ k_a52e g_a2k3 f_a2k2 of
{ Rel f_a2jY [Occ=Once] _ [Occ=Dead] ->
IM.findWithDefault
@ (Set k_a52e)
(empty @ k_a52e)
(fromEnum @ a_a52c $dEnum_a52n x_a2k0)
(f_a2jY
`cast` (T14285a.N:Map[0] ]
:: Enum a_a52c)
(x_a2k0 :: a_a52c)
(rel_a2k1 [Dmd=] :: Rel k_a52e k_a52d) ->
case rel_a2k1 of { Rel f_a2k2 [Dmd=] ->
case fromEnum @ a_a52c $dEnum_a52n x_a2k0 of
{ GHC.Types.I# ww1_a57r [Dmd=] ->
Data.IntMap.Internal.$wfindWithDefault
@ (Set k_a52e)
(empty @ k_a52e)
ww1_a57r
(g_a2k3
`cast` (T14285a.N:Map[0] `, and so is strict, but its
first component is unused.
* And indeed `f_a2k2` is unsed in the body of `pre_images`
* But alas, in the stable-unfolding, `f_a2k2` '''is''' used. It is passed
to `$WRel`, the wrapper for the strict data contructor `Rel`; it evaluates
both arguments.
* So if we w/w this function, we won't pass the first component; instead
we'll make up `absentError "blah"` to fill the hole, expecting it not to
be used.
* Alas, when we do the same thing to the stable unfolding (see `Note
[Worker-wrapper for INLINABLE functions]` in `WorkWrap.hs`) we ''do''
evaluate that `absentError` call. Sigh.
I'm not at all clear what to do about this, but at least we can see what
is going on. It's very much a corner case, so I don't want to harm
mainstream cases for the sake of this one.
--
Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14285#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler