[Top][All Lists]

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

Re: SegFault in 2**111111111 calculation

From: Torbjorn Granlund
Subject: Re: SegFault in 2**111111111 calculation
Date: 06 Dec 2000 19:17:01 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.6

Pearu Peterson <address@hidden> writes:

  I am using the latest GMP 3.1 on
        Linux 2.2.14-15mdk i686
        gcc version 2.95.2 19991024 (release)
  GMP is configured and installed with default compiler flags (-g -O
  -fomit-frame-pointer -mcpu=pentiumpro). make check was success.
  ulimit is 'unlimited'. Tried also --disable-alloc for the test below.
  Now, I have found that when trying to find the power over a huge
  exponent (but still in the range of unsigned long) then Segmentation Fault
  is raised. The test code is given below that calculates BA**EX.
  If BA=2,EX=11, for example, then the output is
  Calculating 2**11:
  mp_allocate( 4 ) ->0x8049b60
  But if EX=111111111 then 
  Calculating 2**111111111:
  mp_allocate( 4 ) ->0x8049b80
  Segmentation fault
  Is this a bug of GMP or anything else? Any hints how to get a control over
  this SegFault are appreciated. Even if there is memory shortage (though
  there shouldn't be, right?), I would expect a more graceful exit.
Some malloc packages return a valid pointer even if there is actually
less VM available.  If the total VM usage of all processes on the
system at some point gets greater than what is available, the system
shots down on process with SIGSEGV.

I suspect that this is what happens on your GNU/Linux system.

If I am right, you should be able to make the program work by adding
more swap.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]