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

GHC ghc-devs at haskell.org
Wed Jan 28 14:32:50 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:  Phab:637
-------------------------------------+-------------------------------------

Comment (by qnikst):

 Replying to [comment:9 simonpj]:
 > I don't know how to reason about what might be "an error at some
 particular stage of the pipeline".
 >
 > ANY use of `unsafeCoerce` might make a program seg-fault.  So at best
 these checks are going to smoke out uses that are more than usually likely
 to cause this behaviour.  It's all very squishy.  Ask a more specific
 question and I'll try to help.
 >
 > S

 I think that Richard means that this check may be useful also in a
 typechecker, as lint will help from problems introduced by ghc, but
 doesn't prevent from incorrect programs to be written and accepted by
 typechecker. So idea was also perform this check in typechecker.

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


More information about the ghc-tickets mailing list