Bug 65695 - incorrect implementation of __moddi3 in libc-2.2.5.so
incorrect implementation of __moddi3 in libc-2.2.5.so
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: libc (Show other bugs)
7.3
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-30 05:13 EDT by Fredrik Sandberg
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-05-30 05:13:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Fredrik Sandberg 2002-05-30 05:13:06 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
Implementation of __moddi3 in libc-2.2.5.so supplied with RH7.3 does not 
produce the correct result in some cases. Works fine on RH7.2 (libc-2.2.4). 
Example: Calculation of -10L % -7L results in 3 instead of -3.

Version-Release number of selected component (if applicable): 2.2.5


How reproducible:
Always

Steps to Reproduce:
1. Write the following c-program:

#include <stdio.h>
typedef long long s8;
void printMod(s8 a, s8 b)
{
   printf("%lld %% %lld = %lld\n", a, b, a%b); 
}
int main(void)
{
   printMod(-10L, -7L);
   printMod(-10L, 7L);
   printMod(10L, -7L);
   printMod(10L, 7L);
   return 0;
}

2. Compile 2 versions like:

gcc -o the_good myprog.c
gcc -o the_bad -lc myprog.c

3. Run programs

Actual Results: 
the_good prints:
-10 % -7 = -3
-10 % 7 = -3
10 % -7 = 3
10 % 7 = 3

the_bad prints:
-10 % -7 = 3
-10 % 7 = -3
10 % -7 = -3
10 % 7 = 3


Expected Results:  both compiles should produce the same (correct) results

Additional info:

Although not yet verified, other problems with arithmetic operations in this 
libc version are suspected.
Comment 1 Jakub Jelinek 2002-09-19 17:51:15 EDT
http://rhn.redhat.com/errata/RHBA-2002-116.html obsoleted by 2 security erratas
in the meantime.

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