FW: Literal overflow test fails
aseipp at pobox.com
Mon Aug 19 10:45:09 CEST 2013
Yes, this slipped by my radar.
I've got my win8 build machine up now, so I can push something shortly.
On Mon, Aug 19, 2013 at 3:40 AM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> 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 at haskell.org] On Behalf Of Ian Lynagh
> Sent: 05 August 2013 16:34
> To: ghc-devs at 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:
> 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.
> ghc-devs mailing list
> ghc-devs at haskell.org
Austin - PGP: 4096R/0x91384671
More information about the ghc-devs