Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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

Summary: mpz_gcdext() function does not provide expected results
Product: Red Hat Enterprise Linux 6 Reporter: Steve Simpson <ssimpson>
Component: gmpAssignee: Frantisek Kluknavsky <fkluknav>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.4   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-06 14:36:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Source file to mpz_gcdext() from libgmp none

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.