Tuesday, October 01, 2019

ghc vs gmp

Hi Matthias,

On Mon, Sep 23, 2019 at 2:40 PM Matthias Kilian <kili@outback.escape.de> wrote:
> Instead of adding more madness (like a patch to diff in this case),
> I compared the bundled gmp sources against the upstream used by
> devel/gmp (which are identical except for the remoced coeumentation
> in ghc's version) and hat a look at at the patch to gmp contained
> in the ghc sources (libraries/integer-gmp/gmp/gmpsrc.patch, which
> only adds -fPIC for some systems).

I was browsing the old ghc patches and we switched from the ports to
the bundled gmp some 7 years ago
https://github.com/openbsd/ports/commit/47aa23534d85b9287ed8fe026c98a13d9e2599e4

I couldn't get my "large Fibonacci numbers" to crash anything. I'm
curious if anybody has a
bottled testcase to try or knows how to modify the one below to stress
things more.

{-# Language BangPatterns #-}
main = mapM_ (putStrLn . take 20 . show . fib) [0..]

fib :: Integer -> Integer
fib n = fibs 1 1 n
where fibs !a !b !n
| n == 0 = a
| otherwise = fibs b (a+b) (n-1)

Thanks
Greg

No comments:

Post a Comment