[GHC] #1006: 'impossible' happened in reportNoInstance?

GHC trac at galois.com
Thu Nov 16 08:46:28 EST 2006


#1006: 'impossible' happened in reportNoInstance?
----------------------------------------+-----------------------------------
    Reporter:  SamB                     |       Owner:         
        Type:  bug                      |      Status:  new    
    Priority:  normal                   |   Milestone:         
   Component:  Compiler (Type checker)  |     Version:  6.7    
    Severity:  normal                   |    Keywords:         
  Difficulty:  Unknown                  |    Testcase:         
Architecture:  Unknown                  |          Os:  Unknown
----------------------------------------+-----------------------------------
This program, though it shouldn't typecheck, shouldn't make the compiler
 panic like this either:

 {{{
 ghc-6.5: panic! (the 'impossible' happened)
   (GHC version 6.5 for i386-unknown-linux):
         reportNoInstance
     $dPrintfType{v alY} :: {<pred>base:Text.Printf.PrintfType{tc r5j}
 (a{tv alO} [sk]
                                                                        ->
 b{tv alP} [sk])}

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 }}}

 Presumably the problem is in the phex part...

 {{{
 {-# OPTIONS_GHC -fglasgow-exts #-}
 #!haskell

 -- Actually, this exercises prelude/PrelRules, but this is the closest
 -- place I could find to put it...

 import GHC.Exts
 import Numeric
 import Text.Printf

 main = do phex (I# (uncheckedIShiftL#  (negateInt# 5#) 2#))
           phex (I# (uncheckedIShiftRA# (negateInt# 5#) 1#))
           phex (I# (uncheckedIShiftRL# (negateInt# 5#) 1#))
           phex (W# (uncheckedShiftL#   (int2Word# (negateInt# 5#)) 2#))
           phex (W# (uncheckedShiftRL#  (int2Word# (negateInt# 5#)) 1#))

 -- this doesn't work on negative numbers :-(
 -- phex x = putStrLn ("0x" ++ showHex x "")

 phex :: a -> b
 phex x = printf "0x%x" x
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1006>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list