Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tommath 0.39 update breaks HEAD build

Closed / Fixed1606554fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-12-01 05:57:10
Compiling bn_mp_div.c rev 1.2 fails with the following errors:

tcl/libtommath/bn_mp_div.c: In function 'TclBN_mp_div':
tcl/libtommath/bn_mp_div.c:164: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c:164: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c:193: warning: implicit declaration of function 'bn_s_mp_div_school'
tcl/libtommath/bn_mp_div.c:200: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c:201: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c:203: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c:211: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c:213: error: invalid type argument of '->'
tcl/libtommath/bn_mp_div.c: At top level:
tcl/libtommath/bn_mp_div.c:254: error: redefinition of 'TclBN_mp_div'
tcl/libtommath/bn_mp_div.c:99: error: previous definition of 'TclBN_mp_div' was here

defining out the newly added (second) mp_div implementation restores the build to working order.

The 0.39 update had also introduced two new warnings that I've already committed fixes for.
dasplain2006-12-01 12:59:52
Logged In: YES 
user_id=90580
Originator: YES

the committed warning fixes were as follows:

Index: bn_mp_div_d.c
===================================================================
RCS file: /cvsroot/tcl/libtommath/bn_mp_div_d.c,v
--- bn_mp_div_d.c1 Dec 2006 00:31:32 -00001.2
+++ bn_mp_div_d.c1 Dec 2006 05:47:47 -00001.3
@@ -20,7 +20,7 @@ static int s_is_power_of_two(mp_digit b,
    int x;
 
    /* quick out - if (b & (b-1)) isn't zero, b isn't a power of two */
-   if ( b & (b-1) != 0 ) {
+   if ((b & (b-1)) != 0) {
        return 0;
    }
    for (x = 1; x < DIGIT_BIT; x++) {
Index: bn_mp_sqrt.c
===================================================================
RCS file: /cvsroot/tcl/libtommath/bn_mp_sqrt.c,v
--- bn_mp_sqrt.c1 Dec 2006 00:31:32 -00001.4
+++ bn_mp_sqrt.c1 Dec 2006 05:48:23 -00001.5
@@ -69,7 +69,7 @@ int mp_sqrt(mp_int *arg, mp_int *ret) 
   if (dig) {
       t1.used = i+2;
       d -= ldexp((double) dig, DIGIT_BIT);
-      if (d != 0,0) {
+      if (d != 0.0) {
   t1.dp[i+1] = dig;
   t1.dp[i] = ((mp_digit) d) - 1;
       } else {
dasplain2006-12-01 13:02:03
data_type - 110894
dasplain2006-12-01 15:38:19
Logged In: YES 
user_id=90580
Originator: YES

the change to #ifdef out the broken mp_div is as follows:

Index: libtommath/bn_mp_div.c
===================================================================
RCS file: /cvsroot/tcl/libtommath/bn_mp_div.c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 bn_mp_div.c
--- libtommath/bn_mp_div.c1 Dec 2006 00:31:32 -00001.2
+++ libtommath/bn_mp_div.c1 Dec 2006 08:02:37 -0000
@@ -87,6 +87,7 @@ LBL_ERR:
 
 #else
 
+#if 0
 /* Integer signed division.
  *
  * c*b + d == a, that is, c = a/b and c = a%b
@@ -236,6 +237,7 @@ int mp_div(mp_int* a, mp_int* b, mp_int*
     return res;
 
 }
+#endif
 
 /* integer signed division. 
  * c*b + d == a [e.g. a/b, c=quotient, d=remainder]
dgpplain2006-12-01 23:03:15
Logged In: YES 
user_id=80530
Originator: NO


I mistakenly committed that workaround
with the TIP 287 implementation.

If a different fix is the correct one,
that will need revision, but should
explain why anyone testing the current
HEAD doesn't see this bug.
kennykbplain2006-12-02 02:47:26
Logged In: YES 
user_id=99768
Originator: NO

Sorry!  I badly bollixed the [cvs merge] that brought in libtommath 0.39.
The HEAD tests ok for me now.
Log in (anonymous is fine) to add a comment.