[Top][All Lists]

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

integer-expt dup init/clear

From: Kevin Ryde
Subject: integer-expt dup init/clear
Date: Sat, 15 Nov 2003 07:21:35 +1000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

A bit of an init/clear gremlin in integer-expt,

        * numbers.c (scm_integer_expt): Don't mpz_init after scm_i_clonebig or
        scm_i_mkbig, since they do so already.  Don't mpz_clear a bignum SCM,
        since gc does this.

The bad cases are a bignum exponent and a flonum exponent bigger than
a fixnum, so

        (integer-expt 0.5 (ash 1 128))
        (gc) (gc)


        (integer-expt 0.5 (exact->inexact (ash 1 128)))
        (gc) (gc)

Run under your favourite malloc debugger to see the duplicate
mpz_clear free when the gc gets around to releasing z_i2.

Attachment: numbers.c.integer-expt.diff
Description: Text document

reply via email to

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