RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1002257 - mpz_gcdext() function does not provide expected results
Summary: mpz_gcdext() function does not provide expected results
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gmp
Version: 6.4
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Frantisek Kluknavsky
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-28 18:15 UTC by Steve Simpson
Modified: 2014-11-06 14:36 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-06 14:36:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Source file to mpz_gcdext() from libgmp (1.23 KB, text/plain)
2013-08-28 18:15 UTC, Steve Simpson
no flags Details

Description Steve Simpson 2013-08-28 18:15:45 UTC
Created attachment 791502 [details]
Source file to mpz_gcdext() from libgmp

Description of problem:
GMP's function mpz_gcdext() returns unexpected results.

This library solves the equation format A*S + B*T = G

One test case that highlighted the error was:
INPUT A=345, B=34587345
OUTPUT S=-14436457, T=144, G=15
EXPECTED S=-601519, T=6, G=15


In order to trace the error

I found this problem while building PHP 5.5 from source, I ran into the following failed test:
gmp_yum gcdext() basic tests [ext/gmp/tests/022.phpt]

To isolate the problem to the library or to PHP, I borrowed the attached C program and ran the calculation and it returned the same values as PHP.

I then built the latest version of GMP (5.1.2) and reran the test. This time it produced the expected results:
OUTPUT S=-601519, T=6, G=15


Version-Release number of selected component (if applicable):
gmp-4.3.1-7.el6_2.2.x86_64


How reproducible:
Either the PHP build test or by compiling the attached test program. Since the test program is a lot faster that is included here.


Steps to Reproduce:
1. Run the following commands on a test system
    gcc -lgmp -o gmptest gmptest.c
    echo 345 > input
    echo 34587345 >> input
    ./gmptest < input


Actual results:
a = 345
b = 34587345
g = 15
s = -14436457
t = 144
g =? 15
a*s + b*t=g
345 * -14436457 + 34587345 * 144 = 15


Expected results:
a = 345
b = 34587345
g = 15
s = -601519
t = 6
g =? 15
a*s + b*t=g
345 * -601519 + 34587345 * 6 = 15

Comment 2 RHEL Program Management 2013-10-13 23:13:23 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 3 Frantisek Kluknavsky 2014-11-06 14:36:21 UTC
The first result satisfies the equation as well as the second result. I do not see a reason why is it called a bug.

Recent versions of gmp add another constraint - choose one of multiple solutions by minimizing 's'. Old gmp-4.3.1 in RHEL 6 does not have this constraint yet.


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