
#13458: Panic with unsafeCoerce and -dcore-lint -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.1 checker) | Keywords: Resolution: | LevityPolymorphism Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Another thought. The current `unsafeCoerce#` (defined in `MkId`) has type {{{ -- unsafeCoerce# :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) -- (a :: TYPE r1) (b :: TYPE r2). -- a -> b }}}` But it's super-dangerous to coerce from (say) a pointer type to a `Word#` and back. Perhaps the slightly more restrictive type {{{ -- unsafeCoerce# :: forall (r :: RuntimeRep) -- (a :: TYPE r) (b :: TYPE r). -- a -> b }}} would correctly capture many the "rule" specified in the documentation for `unsafeCoerce`? Regardless, a crash is bad. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13458#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler