[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Haddock files are patched to be arch independent again



Kari Pahula wrote:
> I patched ghc6's Binary module to fit an Int in 4 bytes on 64 bit
> architectures, too.  It's a runtime error if they try to put anything
> too large in there.  If something uses Binary and hits this, it should
> be changed to use Int64.  Haddock version 2.4.1-4 implements this
> change.

I'm concerned about this though -- is upstream going to take this patch?
 I wouldn't want our ghc6 to be incompatible with the same version using
the same module on other platforms.

> 
> This means that we can resume putting .haddock files in -doc packages.
> ghc6-doc -13 does this already, and I've uploaded new versions of what
> libraries I have so far packaged for 6.10.1 with that.  I NMUed
> haskell-devscripts for this, too.  I hope you didn't mind.
> 
> Now I just wish I would have done this change in the first place,
> instead of moving .haddock files around.
> 
> Note that this is about Binary, which is internal to GHC, not
> Data.Binary.
> 
> --- ghc6-6.10.1+dfsg1.orig/compiler/utils/Binary.hs     2009-02-25 05:49:14.000000000 +0200
> +++ ghc6-6.10.1+dfsg1/compiler/utils/Binary.hs  2009-02-25 07:25:39.000000000 +0200
> @@ -404,10 +404,13 @@
>          x <- get bh
>          return $! (fromIntegral (x :: Int32))
>  #elif SIZEOF_HSINT == 8
> -    put_ bh i = put_ bh (fromIntegral i :: Int64)
> +    put_ bh i = if (i < (fromIntegral (minBound::Int32))
> +                          || i > (fromIntegral (maxBound::Int32)))
> +                then error "Binary.instance Binary Int: Int out of bounds for Int32"
> +                else put_ bh (fromIntegral i :: Int32)
>      get  bh = do
>          x <- get bh
> -        return $! (fromIntegral (x :: Int64))
> +        return $! (fromIntegral (x :: Int32))
>  #else
>  #error "unsupported sizeof(HsInt)"
>  #endif


Reply to: