#2880: GHC panic when printing Unique
------------------------------+---------------------------------------------
 Reporter:  sebf              |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Milestone:                  
Component:  Compiler          |        Version:  6.10.1          
 Severity:  normal            |     Resolution:                  
 Keywords:                    |       Testcase:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
------------------------------+---------------------------------------------
Comment (by batterseapower):

 I don't think this is actually a bug. Printing a Unique actually does
 require access to the static flags, so  you need to initialize them as the
 panic suggests.

 The relevant code is in Unique.lhs:

 {{{
 pprUnique :: Unique -> SDoc
 pprUnique uniq
   | opt_SuppressUniques
   = empty       -- Used exclusively to suppress uniques so you
   | otherwise   -- can compare output easily
   = case unpkUnique uniq of
       (tag, u) -> finish_ppr tag u (text (iToBase62 u))
 }}}

 Note the use of opt_SuppressUniques, a static flag, which pulls on the
 staticFlags thunk and hence causes the panic.

 I'm not sure we actually intend UniqSupply et al. to be used outside the
 context of GHC session, so this behaviour does not surprise me...

 You can probably fix it by doing:

 {{{
 import UniqSupply
 import StaticFlagParser (parseStaticFlags)

 main = do
   parseStaticFlags []
   mkSplitUniqSupply 'x' >>= print . uniqFromSupply
 }}}

 This will most likely continue to work in the future, but there are no
 guarantees :-)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2880#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to