Bug 1106276 - mpz_invert returns incorrect value
Summary: mpz_invert returns incorrect value
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gmp
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Frantisek Kluknavsky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F-ExcludeArch-ppc64le, PPC64LETracker F21FTBFS
TreeView+ depends on / blocked
 
Reported: 2014-06-09 04:07 UTC by Dennis Gilmore
Modified: 2014-11-06 18:06 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-11-06 18:06:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
build.log (4.09 MB, text/plain)
2014-06-09 04:08 UTC, Dennis Gilmore
no flags Details
root.log (134.23 KB, text/plain)
2014-06-09 04:08 UTC, Dennis Gilmore
no flags Details
state.log (1.06 KB, text/plain)
2014-06-09 04:08 UTC, Dennis Gilmore
no flags Details

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.


Note You need to log in before you can comment on or make changes to this bug.