Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1006 closed bug (fixed)

'impossible' happened in reportNoInstance?

Reported by: SamB Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: tcfail171 Blocked By:
Blocking: Related Tickets:

Description

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

Change History (4)

comment:1 Changed 7 years ago by simonpj

  • Test Case set to tcfail171

I've fixed this. Thanks for reporting it.

tcfail171 tests

Simon

comment:2 Changed 7 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed

comment:3 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:4 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.