Mailing List Archive

Problem with test
G'day,

I've noted a test failure that appears to only occur on one machine.

The test failure:
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: test_rshift: rshift by 0 failed
FAIL: t-mpi-bit
(the other 13 tests pass).

System configuration:
x86_64, running Linux (Fedora Core 4)
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
(I also tried using gcc32, same result)

I don't see this problem on an ia32 box. I can't see how, but possibly it is a
64-bit problem?

Brad
Re: Problem with test [ In reply to ]
On Tue, 22 Aug 2006 12:54, Brad Hards said:

> I don't see this problem on an ia32 box. I can't see how, but possibly it is a
> 64-bit problem?

Please run it as:

$ cd tests
$ ./t-mpi-bit --verbose


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: Problem with test [ In reply to ]
On Tuesday 22 August 2006 23:41, Werner Koch wrote:
> On Tue, 22 Aug 2006 12:54, Brad Hards said:
> > I don't see this problem on an ia32 box. I can't see how, but possibly it
> > is a 64-bit problem?
>
> Please run it as:
>
> $ cd tests
> $ ./t-mpi-bit --verbose
Sorry, should have realised that.

t-mpi-bit: checking that set_bit does only set one bit
t-mpi-bit: r=0000000000000000000000000000000000000000000000000000000000000000000000
t-mpi-bit: checking that set_highbit does only set one bit
t-mpi-bit: r=0000000000000000000000000000000000000000000000000000000000000000000000
t-mpi-bit: checking that rshift works as expected (pass 0)
t-mpi-bit: got =000110110000111101010011110001001101011011001010000100100111101111111111
t-mpi-bit: want=000110110000111101010011110001001101011011001010000100100111101111101111
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: checking that rshift works as expected (pass 1)
t-mpi-bit: got =100110111000011111000100000011110100111101001000000001000001110010011011
t-mpi-bit: want=100110111000011111000100000011110100111101001000000001000001110000010011
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: checking that rshift works as expected (pass 2)
t-mpi-bit: got =111011000001100010101001111110001011000101010100010011111111010011111110
t-mpi-bit: want=111011000001100010101001111110001011000101010100010011111111010010010110
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: checking that rshift works as expected (pass 3)
t-mpi-bit: got =001001111011001111000100101001000000110101000111000111101101001011111111
t-mpi-bit: want=001001111011001111000100101001000000110101000111000111101101001011011100
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: checking that rshift works as expected (pass 4)
t-mpi-bit: got =101000010101010100010111010001100000111110101001101100011110110011111011
t-mpi-bit: want=101000010101010100010111010001100000111110101001101100011110110001111011
t-mpi-bit: test_rshift: rshift by 0 failed
t-mpi-bit: All tests completed. Errors: 5
Re: Problem with test [ In reply to ]
On Tue, 22 Aug 2006 12:54, Brad Hards said:

> I don't see this problem on an ia32 box. I can't see how, but possibly it is a
> 64-bit problem?

Please try the patch below (in libgrypt/mpi/). This should fix it.


Shalom-Salam,

Werner


===================================================================
--- mpi-bit.c (revision 1172)
+++ mpi-bit.c (working copy)
@@ -256,7 +256,17 @@
x->nlimbs = xsize;

if ( xsize )
- _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
+ {
+ if (nbits )
+ _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
+ else
+ {
+ /* The rshift helper function is not specified for
+ NBITS==0, thus we do a plain copy here. */
+ for (i=0; i < x->nlimbs; i++ )
+ x->d[i] = a->d[i];
+ }
+ }
}
MPN_NORMALIZE (x->d, x->nlimbs);
}



_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: Problem with test [ In reply to ]
On Saturday 26 August 2006 00:34, Werner Koch wrote:
> --- mpi-bit.c   (revision 1172)
> +++ mpi-bit.c   (working copy)
> @@ -256,7 +256,17 @@
>        x->nlimbs = xsize;
>        
>        if ( xsize )
> -        _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
> +        {
> +          if (nbits )
> +            _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
> +          else
> +            {
> +              /* The rshift helper function is not specified for
> +                 NBITS==0, thus we do a plain copy here. */
> +              for (i=0; i < x->nlimbs; i++ )
> +                x->d[i] = a->d[i];
> +            }
> +        }
>      }
>    MPN_NORMALIZE (x->d, x->nlimbs);
>  }
Now good:

$ ./t-mpi-bit --verbose
t-mpi-bit: checking that set_bit does only set one bit
t-mpi-bit:
r=0000000000000000000000000000000000000000000000000000000000000000000000
t-mpi-bit: checking that set_highbit does only set one bit
t-mpi-bit:
r=0000000000000000000000000000000000000000000000000000000000000000000000
t-mpi-bit: checking that rshift works as expected (pass 0)
inp= CD570A538852236914
inp= CD570A538852236914
out= CD570A538852236914
t-mpi-bit: checking that rshift works as expected (pass 1)
inp= A52197ED49D19C620A
inp= A52197ED49D19C620A
out= A52197ED49D19C620A
t-mpi-bit: checking that rshift works as expected (pass 2)
inp= 36DB517C8E2EAE0296
inp= 36DB517C8E2EAE0296
out= 36DB517C8E2EAE0296
t-mpi-bit: checking that rshift works as expected (pass 3)
inp= B61E2D1C7A2A7FD12E
inp= B61E2D1C7A2A7FD12E
out= B61E2D1C7A2A7FD12E
t-mpi-bit: checking that rshift works as expected (pass 4)
inp= D30FC4FB1F415A5F8B
inp= D30FC4FB1F415A5F8B
out= D30FC4FB1F415A5F8B
t-mpi-bit: All tests completed. Errors: 0

Thanks.

Brad
Re: Problem with test [ In reply to ]
On Sat, 26 Aug 2006 01:52, Brad Hards said:

> Now good:

great. Now doing a new release.


Shalom-Salam,

Werner


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel