Bug 65695 - incorrect implementation of __moddi3 in libc-2.2.5.so
Summary: incorrect implementation of __moddi3 in libc-2.2.5.so
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libc
Version: 7.3
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-30 09:13 UTC by Fredrik Sandberg
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-05-30 09:13:11 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2002:116 0 high SHIPPED_LIVE Updated GNU C library packages available 2002-06-18 04:00:00 UTC

Description Fredrik Sandberg 2002-05-30 09:13:06 UTC
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 21:51:15 UTC
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.