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

GHC ghc-devs at haskell.org
Wed Jan 28 13:19:55 UTC 2015


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

Comment (by goldfire):

 I'm helping qnikst out with this, but I have a question.

 Say someone writes

 {{{
 unsafeCoerce# (3 :: Int) :: Int#
 }}}

 According to the original feature request, this should be a Core Lint
 error. However, is it an error earlier in the GHC pipeline? In 7.8.3, this
 compiles just fine, though it falls over rather completely when run. (No
 surprise there!) If it's ''not'' an error earlier, this would seem to
 violate the principle that Core Lint should just be checking for GHC bugs,
 not user silliness.

 So, is it necessary to check for such silliness in the typechecker now,
 too?

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


More information about the ghc-tickets mailing list