Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-02-22
22:44 • Closed ticket [1601380fff]: "UpdateStringOfBignum" error with tcl 8.5a... artifact: 215f0884e7 user: kennykb
22:37 • Open ticket [1601380fff]. artifact: f2d645bf6d user: alhernau
2007-02-13
10:55 • Pending ticket [1601380fff]. artifact: 542d70d9e6 user: kennykb
2006-12-18
22:55 • Ticket [1601380fff]: 4 changes artifact: c3f84d75d3 user: dgp
2006-11-27
22:04 • Ticket [1601380fff]: 4 changes artifact: 862173cb95 user: dgp
21:20 • Ticket [1601380fff]: 4 changes artifact: 6722c02087 user: dgp
21:04 • Ticket [1601380fff]: 4 changes artifact: a4df779bdc user: alhernau
2006-11-24
23:49 • Ticket [1601380fff]: 5 changes artifact: 23e03b7091 user: dgp
2006-11-23
04:13 • Ticket [1601380fff]: 4 changes artifact: 1f839d69bb user: dgp
04:03 • Ticket [1601380fff]: 6 changes artifact: 54880d2576 user: dgp
2006-11-22
20:27 • New ticket [1601380fff]. artifact: 76c6467837 user: alhernau

"UpdateStringOfBignum" error with tcl 8.5a5 on x86_64

Closed / Fixed1601380fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-11-22 20:27:34
I've compiled both 8.5a4 and 8.5a5 on a Linux RedHad
t EL x86_64 box.
Both fails evaluating "expr 2**63" and exits/crashes with following error: "UpdateStringOfBignum: string length limit exceeded"
Also evaluating "expr pow(2,63)" twice give a result on first call, then a "Floating point exception" followed by crash on second one.

Let me know if the compilation log is suitable (~200kB)

TCL_LIBRARY=~/compilation/tcl/tcl8.5a5/library LD_LIBRARY_PATH=~/compilation/tcl/tcl8.5a5/unix/Linux64 ~/compilation/tcl/tcl8.5a5/unix/Linux64/tclsh
% expr 2**63
UpdateStringOfBignum: string length limit exceeded
Aborted
--- 
% expr pow(2,63)
9.223372036854776e+18
% expr pow(2,63)
Floating point exception
dgpplain2006-11-23 04:03:45
Logged In: YES 
user_id=80530
Originator: NO


We've fixed some bugs in
the ** operator since 8.5a5
was released.  Can you repeat
the problem in current
development sources?
dgpplain2006-11-23 04:13:33
Logged In: YES 
user_id=80530
Originator: NO

please note the two issues
you report are almost certainly
not related.  Open two reports.
dgpplain2006-11-24 23:49:34
Logged In: YES 
user_id=80530
Originator: NO


Can you check that the
mp_radix_size() call on
line 2619 of tclObj.c is
in fact returning the
value 3 ?

If so, can you explain why?
Perhaps there's a libtommath
bug here?
alhernauplain2006-11-27 21:04:15
Logged In: YES 
user_id=818162
Originator: YES

I've finally managed to get CVS code and recompile it again (got 64bit machine at work and CVS access at home).
I reproduce same behaviour: the tclsh binary exits with "UpdateStringOfBignum" error.

The values returned by mp_radix_size are: status=0, size=3

It seems the problem comes from mp_div_d, into following code portion,
it returns 2 on first call, then 0, leading to "digs" being set to 1.

  while (mp_iszero (&t) == MP_NO) {
    if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {
      mp_clear (&t);
      return res;
    }
    ++digs;
  }

I unfortunately have no time left to dig further today ...
dgpplain2006-11-27 21:20:56
Logged In: YES 
user_id=80530
Originator: NO


"returns 2 on first call"

Are you referring to the
return value stored in "res",
or to the value of &t after
the mp_div_d call returns?
dgpplain2006-11-27 22:04:39
Logged In: YES 
user_id=80530
Originator: NO


Can you check that

  sizeof(mp_word) > 2*DIGIT_BIT + 1

?
dgpplain2006-12-18 22:55:53
Logged In: YES 
user_id=80530
Originator: NO

see 1617840
kennykbplain2007-02-13 10:55:48
Logged In: YES 
user_id=99768
Originator: NO

gcc appears to have some grievous bugs near the handling of __attributes(mode(TI))__. I've patched the code that uses those attributes out of our fork of libtommath.  Can you retest with
the current HEAD in a clean sandbox?
alhernauplain2007-02-22 22:37:04
Logged In: YES 
user_id=818162
Originator: YES

Seems fixed, pow(2,63) no more crashes tclsh 
(tested with cvs code downloaded on Feb, 14th)
kennykb Closed ticket [1601380fff]. [History diff]2007-02-22 22:44:51
Log in (anonymous is fine) to add a comment.