segfault/massive memory use when using Data.Bits.shiftL

Ganesh Sittampalam ganesh at
Mon Feb 28 17:59:32 EST 2005

On Mon, 28 Feb 2005, Remi Turk wrote:

> On Mon, Feb 28, 2005 at 02:55:56PM +0000, Ganesh Sittampalam wrote:
> >
> > Prelude> :m +Data.Bits
> > Prelude Data.Bits> 18446658724119492593 `shiftL` (-3586885994363551744) ::
> > Integer
> and calculating, in your case, 2^3586885994363551744 is not
> something your computer is going to like...
> as it's probably a number which doesn't fit in our universe :)

Hmm, good point. I hadn't thought about the fact that the number of digits
in the answer would be rather large...

> Still, a segfault might point at a bug, which I unfortunately
> won't be able to say much about. (Due to lack of knowledge &
> information.)

My googling suggests that gmp is prone to segfaulting when things get too
large for it, so I'll just chalk it up to that.

I apologise for thinking this was a bug :-)



More information about the Glasgow-haskell-users mailing list