なかだです。

At Fri, 22 Feb 2008 00:26:17 +0900,
Urabe Shyouhei wrote in [ruby-dev:33889]:
> > while true
> >   ObjectSpace.each_object(Numeric) { |a, b| print a, b, "\n" }
> > end
> >
> > output:
> >
> > ...
> > nil
> > ...
> > nil
> > nil
> > (irb):91: [BUG] rb_sys_fail() - errno == 0
> > ruby 1.8.6 (2007-06-07) [x86_64-linux]
> >
> > Aborted (core dumped)

とりあえず。


Index: trunk/bignum.c =================================================================== --- trunk/bignum.c (revision 15565) +++ trunk/bignum.c (working copy) @@ -37,5 +37,17 @@ VALUE rb_cBignum; #define BDIGMAX ((BDIGIT)-1) -#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || (RBIGNUM_LEN(x) == 1 && BDIGITS(x)[0] == 0)) +#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \ + (BDIGITS(x)[0] == 0 && \ + (RBIGNUM_LEN(x) == 1 || bigzero_p(x)))) + +static int +bigzero_p(VALUE x) +{ + long i; + for (i = 0; i < RBIGNUM_LEN(x); ++i) { + if (BDIGITS(x)[i]) return 0; + } + return 1; +} #define RBIGNUM_SET_LEN(b,l) \ Index: stable/bignum.c =================================================================== --- stable/bignum.c (revision 15565) +++ stable/bignum.c (working copy) @@ -38,5 +38,19 @@ VALUE rb_cBignum; #define BDIGMAX ((BDIGIT)-1) -#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || (RBIGNUM(x)->len == 1 && BDIGITS(x)[0] == 0)) +#define BIGZEROP(x) (RBIGNUM(x)->len == 0 || \ + (BDIGITS(x)[0] == 0 && \ + (RBIGNUM(x)->len == 1 || bigzero_p(x)))) + +static int bigzero_p(VALUE); +static int +bigzero_p(x) + VALUE x; +{ + long i; + for (i = 0; i < RBIGNUM(x)->len; ++i) { + if (BDIGITS(x)[i]) return 0; + } + return 1; +} static VALUE
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦