[GHC] #9122: Make Lint check for bad uses of `unsafeCoerce`

GHC ghc-devs at haskell.org
Mon May 19 16:18:20 UTC 2014


#9122: Make Lint check for bad uses of `unsafeCoerce`
-------------------------------------+------------------------------------
        Reporter:  simonpj           |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by goldfire):

 I was thinking of someone who wanted the raw pointer associated with a
 value of a lifted type. Coercing `Int` to `Int#` would seemingly get that
 pointer value. It's conceivable to me to imagine scenarios where this
 behavior is desired, such as debugging against some sort of memory dump.
 Going the other way might also be desirable, if Haskell code has to
 operate against some pre-loaded memory image. Maybe these sorts of things
 never happen in Haskell, but I've done them (when debugging kernels /
 device drivers) in other languages. Or, is the idea that all such
 shenanigans are subsumed by `Foreign.Ptr` and friends?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9122#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list