
Austin Could you act on this thread please? Currently I think the Windows build is broken because of it. I think Ian is right, namely that the way to get a particular bit-pattern with type 'Int' is to use fromIntegral. But it needs a comment to explain the idiom. eg try compiling this with -O: import Data.Int import Data.Word foo :: Int32 foo = fromIntegral (0x80000000 :: Word32) :: Int32 You get Foo.foo = GHC.Int.I32# (-2147483648) -----Original Message----- From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Ian Lynagh Sent: 05 August 2013 16:34 To: ghc-devs@haskell.org Subject: Re: Literal overflow test fails On Sat, Aug 03, 2013 at 09:47:07PM +0000, Simon Peyton-Jones wrote:
libraries\Win32\Graphics\Win32\GDI\HDC.hs:145:14: Warning: Literal 2147483648 of type Int overflows
The offending code is:
setTextCharacterExtra dc extra = failIf (== 0x80000000) "SetTextCharacterExtra" $ c_SetTextCharacterExtra dc extra
- should we use minBound here?
The spec defines the failure value as 0x80000000, so it would be better to use that constant: http://msdn.microsoft.com/en-us/library/windows/desktop/dd145092%28v=vs.85%2... I had a similar problem with a 0xdeadbeef constant in the compiler source. I changed it to be fromIntegral (0xdeadbeef :: Word32) instead. I'd suggest doing similarly for the 0x80000000.
- what should the new literal-overlflow code do for 0xblah constants?
In my opinion, it's doing the right thing. Thanks Ian _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs