Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#2457 closed bug (fixed)

Seq causes panic in GHCi

Reported by: thoughtpolice Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.8.3
Keywords: Cc:
Operating System: MacOS X Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


While trying to understand the semantic differences between seq and pseq, when looking at the Control.Parallel page, it says that the compiler may transform "x seq y" into "y seq x seq y"

Trying this in GHCi lead me to this:

$ ghci
GHCi, version 6.8.3:  :? for help
Loading package base ... linking ... done.
Prelude> let x = tail [1..]
Prelude> x `seq` ()
Prelude> () `seq` x `seq` ()
ghc-6.8.3: panic! (the 'impossible' happened)
  (GHC version 6.8.3 for i386-apple-darwin):
	nameModule (){v 71}

Please report this as a GHC bug:


When testing this in a file however, things go smoothly:

$ cat seq.hs 
x = tail [1..]

-- x `seq` y can apparently be transformed
-- into y `seq` x `seq y
v = () `seq` x `seq` ()

main = return v
$ ghc --make seq.hs
[1 of 1] Compiling Main             ( seq.hs, seq.o )
Linking seq ...
$ ./seq; echo $?

I cannot be sure if this bug still occurs as of GHC 6.9.20080720, as ghci is apparently broken in my build (this could have to do with build settings but I am not sure, it has to do with the fact that the base library can't find the _environ symbol; should I file another report?)

Change History (3)

comment:1 Changed 9 years ago by igloo

difficulty: Unknown
Resolution: fixed
Status: newclosed

Thanks for the report; happily, this works in the HEAD:

GHCi, version 6.9.20080720:  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> let x = tail [1..]
Prelude> x `seq` ()
Prelude> () `seq` x `seq` ()

We discovered the _environ problem in #ghc yesterday. I have a fix in my tree which I should be able to push soon.

comment:2 Changed 9 years ago by duncan

It's weirder than that though. It works in 6.8.2 (on amd64/linux at least). Does it fail with 6.8.3 on all platforms or is it just OSX?

comment:3 Changed 9 years ago by igloo

All platforms, yes. I assume it was caused by

Fri May 16 09:51:49 BST 2008
  * Improve the treatment of 'seq' (Trac #2273)

and fixed by

Tue Jul  1 17:37:22 BST 2008
  * Easy fix for Trac #2409

but I haven't verified that.

Note: See TracTickets for help on using tickets.