Bug 1106276
| Summary: | mpz_invert returns incorrect value | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Dennis Gilmore <dennis> | ||||||||
| Component: | gmp | Assignee: | Frantisek Kluknavsky <fkluknav> | ||||||||
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||||
| Severity: | unspecified | Docs Contact: | |||||||||
| Priority: | unspecified | ||||||||||
| Version: | rawhide | CC: | efintzel, fkluknav, loganjerry, normand, paulo.cesar.pereira.de.andrade, tomspur | ||||||||
| Target Milestone: | --- | ||||||||||
| Target Release: | --- | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Whiteboard: | |||||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||||
| Doc Text: | Story Points: | --- | |||||||||
| Clone Of: | Environment: | ||||||||||
| Last Closed: | 2014-11-06 18:06:35 UTC | Type: | --- | ||||||||
| Regression: | --- | Mount Type: | --- | ||||||||
| Documentation: | --- | CRM: | |||||||||
| Verified Versions: | Category: | --- | |||||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||||
| Embargoed: | |||||||||||
| Bug Depends On: | |||||||||||
| Bug Blocks: | 1051573, 1105908 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Dennis Gilmore
2014-06-09 04:07:53 UTC
Created attachment 904388 [details]
build.log
Created attachment 904389 [details]
root.log
Created attachment 904390 [details]
state.log
This is a test failure due to a change in the GMP function mpz_invert. Consider the following code:
#include <gmp.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
mpz_t d, e, f;
mpz_inits(d, e, f, NULL);
mpz_set_ui(d, 100);
mpz_set_si(e, -1);
if (mpz_invert(f, d, e))
gmp_printf("Inverse is %Zd\n", f);
else
puts("Inverse does not exist");
mpz_clears(d, e, f, NULL);
return EXIT_SUCCESS;
}
On Fedora 20 (gmp 5.1.2), this prints:
Inverse does not exist
On Rawhide (gmp 6.0.0), this prints:
Inverse is 0
This is a bug in GMP. Try replacing the -1 with various other values in: mpz_set_si(e, -1) and you will quickly see that mpz_invert() is returning zero when it should be returning nonzero, and is returning nonzero when it should be returning zero. as per http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=1959124 the flint-2.4.2-4.fc21 do build at least on ppc64 et ppc64le. It is a deliberate upstream decision to have "anything modulo +-1 = 0", as discussed in https://gmplib.org/list-archives/gmp-bugs/2014-April/003440.html and following posts. Documentation shipped in the source tarball does not yet reflect this change but is already fixed in upstream git repo https://gmplib.org/repo/gmp/diff/55ff6b8d9a92/doc/gmp.texi . Except +1 and -1, I could not find any other modulus with weird behaviour. |