[GHC] #449: Very big integer arithmetic crashes GHCi on Windows and Mac

GHC trac at galois.com
Thu Feb 23 08:31:01 EST 2006


#449: Very big integer arithmetic crashes GHCi on Windows and Mac
-----------------------------+----------------------------------------------
  Reporter:  simonpj         |          Owner:  simonmar
      Type:  bug             |         Status:  closed  
  Priority:  normal          |      Milestone:  6.4.2   
 Component:  Runtime System  |        Version:  6.4.1   
  Severity:  minor           |     Resolution:  wontfix 
  Keywords:                  |             Os:  Windows 
Difficulty:  Unknown         |   Architecture:  Unknown 
-----------------------------+----------------------------------------------
Changes (by simonmar):

  * architecture:  => Unknown
  * resolution:  None => wontfix
  * difficulty:  => Unknown
  * status:  new => closed
  * os:  => Windows

Comment:

 I believe this is the process running out of C stack space.  GMP allocates
 some temporaries on the C stack, and it looks like this is overlowing the
 C stack.

 Here's the backtrace I got:
 {{{
 (gdb) where
 #0  0x00da19f3 in probe ()
 #1  0x01e02008 in ?? ()
 #2  0x00d9bc36 in __gmpn_sqr_n (prodp=0x2002008, up=0x1e02008, un=262145)
     at mul.c:79
 #3  0x00d9bf49 in __gmpn_mul (prodp=0x2002008, up=0x1e02008, un=262145,
     vp=0x1e02008, vn=262145) at mul.c:111
 #4  0x00d99953 in __gmpz_mul (w=0xeb1130, u=0xeb1170, v=0xeb1150) at
 mul.c:122
 #5  0x00d7deb5 in timesIntegerzh_fast ()
 #6  0x00eb1130 in pinned_object_block ()
 #7  0x00eb1170 in mp_result2 ()
 #8  0x00eb1150 in mp_tmp_w ()
 #9  0x00000000 in ?? () from
 (gdb) up
 #1  0x01e02008 in ?? ()
 (gdb)
 #2  0x00d9bc36 in __gmpn_sqr_n (prodp=0x2002008, up=0x1e02008, un=262145)
     at mul.c:79
 79            tspace = (mp_ptr) TMP_ALLOC (2 * (un + BITS_PER_MP_LIMB) *
 BYTES_PER_MP_LIMB);
 }}}

 and it appears that TMP_ALLOC() is mapped to alloca() when using GCC (see
 gmp-impl.h).

-- 
Ticket URL: <http://cvs.haskell.org/trac/ghc/ticket/449>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list