Opened 5 years ago

Closed 5 years ago

#9254 closed bug (fixed)

Entered absent argument (again)

Reported by: simonpj Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Consider this program:

{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Main where
import GHC.Exts

f :: (() -> (# Int#, () #)) -> ()
{-# NOINLINE f #-}
-- Strictness signature was (7.8.2)
--    <C(S(LS)), 1*C1(U(A,1*U()))>
-- I.e. calls k, but discards first component of result
f k = case k () of (# _, r #) -> r

g :: Int -> ()
g y = f (\n -> (# case y of I# y2 -> h (h (h (h (h (h (h y2)))))), n #))
   -- RHS is big enough to force worker/wrapper

{-# NOINLINE h #-}
h :: Int# -> Int#
h n = n +# 1#

main = print (g 1)

You'll get

bash$ ghc -O -o foo Foo.hs
bash$ ./foo
foo: Oops!  Entered absent arg w_s4vl Int

Ugh! This is the bug underlying this bug report.

I know what is going on.

Change History (3)

comment:1 Changed 5 years ago by Simon Peyton Jones <simonpj@…>

In d6ee82b29598dcc1028773dd987b7a2fb17519b7/ghc:

Fix demand analyser for unboxed types

This is a tricky case exposed by Trac #9254.  I'm surprised it hasn't
shown up before, because it's happens when you use unsafePerformIO in
the right way.

Anyway, fixed now.  See Note [Analysing with absent demand]
in Demand.lhs

comment:2 Changed 5 years ago by simonpj

Status: newmerge

Merge to 7.8; either 7.8.3 if time or 7.8.4 if not.

comment:3 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.