Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1106276

Summary: mpz_invert returns incorrect value
Product: [Fedora] Fedora Reporter: Dennis Gilmore <dennis>
Component: gmpAssignee: Frantisek Kluknavsky <fkluknav>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: 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 Flags
build.log
none
root.log
none
state.log none

Description Dennis Gilmore 2014-06-09 04:07:53 UTC
Your package flint failed to build from source in current rawhide.

http://koji.fedoraproject.org/koji/taskinfo?taskID=6964188

For details on mass rebuild see https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

Comment 1 Dennis Gilmore 2014-06-09 04:08:08 UTC
Created attachment 904388 [details]
build.log

Comment 2 Dennis Gilmore 2014-06-09 04:08:10 UTC
Created attachment 904389 [details]
root.log

Comment 3 Dennis Gilmore 2014-06-09 04:08:11 UTC
Created attachment 904390 [details]
state.log

Comment 4 Jerry James 2014-06-09 19:22:15 UTC
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

Comment 5 Jerry James 2014-06-09 19:32:49 UTC
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.

Comment 6 Michel Normand 2014-07-22 08:09:06 UTC
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.

Comment 7 Frantisek Kluknavsky 2014-11-06 18:06:35 UTC
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.