This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 65612 - wrong results from __moddi3
wrong results from __moddi3
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.3
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-28 11:55 EDT by Radu Greab
Modified: 2007-04-18 12:42 EDT (History)
2 users (show)

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


Attachments (Terms of Use)
Test code (407 bytes, text/plain)
2002-05-28 11:56 EDT, Radu Greab
no flags Details
Proposed patch (310 bytes, patch)
2002-05-28 11:58 EDT, Radu Greab
no flags Details | Diff

  None (edit)
Description Radu Greab 2002-05-28 11:55:41 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513

Description of problem:
If modulo operands are long long int, thus __moddi3 is used, and the second
argument of modulo is negative, then the result has the opposite sign then the
correct one.


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


How reproducible:
Always

Steps to Reproduce:
1. Compile the test code as usual: "gcc -Wall t1.c". __moddi3 from libgcc is
used and you get the right results.
2. Compile the test code but force it to use __moddi3 from glibc: "gcc -Wall -lc
t1.c". You get the wrong results.


Actual Results:
  3 %  10 =   3
  3 % -10 =  -3
 -3 %  10 =  -3
 -3 % -10 =   3


Expected Results:
  3 %  10 =   3
  3 % -10 =   3
 -3 %  10 =  -3
 -3 % -10 =  -3


Additional info:
Comment 1 Radu Greab 2002-05-28 11:56:42 EDT
Created attachment 58767 [details]
Test code
Comment 2 Radu Greab 2002-05-28 11:58:09 EDT
Created attachment 58768 [details]
Proposed patch
Comment 3 Hui Huang 2002-09-19 17:27:20 EDT
Any plan to fix this in the near future? Java "longs" are "long longs"
on x86. This bug is definitely having a big impact on us.
Comment 4 Jakub Jelinek 2002-09-19 17:35:02 EDT
http://rhn.redhat.com/errata/RHBA-2002-116.html obsoleted by 2 security erratas
in the mean time.

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