#3948: unsafeCoerce leaks types
-------------------------------+--------------------------------------------
  Reporter:  ksf               |          Owner:                
      Type:  bug               |         Status:  closed        
  Priority:  normal            |      Milestone:                
 Component:  Template Haskell  |        Version:  6.12.1        
Resolution:  invalid           |       Keywords:                
Difficulty:                    |             Os:  Linux         
  Testcase:                    |   Architecture:  x86_64 (amd64)
   Failure:  None/Unknown      |  
-------------------------------+--------------------------------------------
Changes (by simonmar):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 At the risk of being glib, this is an unsafe use of `unsafeCoerce`.
 `Int32` is internally represented as an `Int#`, which is 64 bits on your
 platform, but there's a representation invariant that the upper 32 bits
 are guaranteed to be either all zero or all one.  The invariant is
 respected by all the operations on `Int32`, but by using `unsafeCoerce`
 you created an invalid `Int32`.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3948#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to