This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bignum printing bug



> Someone reported a bug a while ago in the bignum support: a factorial
> procedure wasn't giving the right answer.  e.g.,:
> ...
> it's probably system-specific: i get the bug on i586/linux;
> gcc 2.7.2 and gcc 2.8.1, but only if numbers.c is optimised:
> -O will do.
> 
> the problem seems to be in the bignum -> string conversion.
> this is a work-around: i don't know why it helps.

Thanks for tracking this down.  Could you try out this patch?

1998-10-10  Jim Blandy  <jimb@zwingli.cygnus.com>

	* numbers.c (big2str): Protect t from garbage collection until
	we're done.

Index: numbers.c
===================================================================
RCS file: /egcs/carton/cvsfiles/guile/guile-core/libguile/numbers.c,v
retrieving revision 1.20
diff -c -c -r1.20 numbers.c
*** numbers.c	1998/09/06 18:15:59	1.20
--- numbers.c	1998/10/10 19:26:36
***************
*** 1418,1424 ****
      for(i = j;j < SCM_LENGTH(ss);j++) s[ch+j-i] = s[j]; /* jeh */
      scm_vector_set_length_x(ss, (SCM)SCM_MAKINUM(ch+SCM_LENGTH(ss)-i)); /* jeh */
    }
!   return ss;
  }
  #endif
  
--- 1418,1425 ----
      for(i = j;j < SCM_LENGTH(ss);j++) s[ch+j-i] = s[j]; /* jeh */
      scm_vector_set_length_x(ss, (SCM)SCM_MAKINUM(ch+SCM_LENGTH(ss)-i)); /* jeh */
    }
! 
!   return scm_return_first (ss, t);
  }
  #endif