Bug 65612 - wrong results from __moddi3
Summary: wrong results from __moddi3
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 7.3
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-28 15:55 UTC by Radu Greab
Modified: 2016-11-24 15:00 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-09-19 21:27:26 UTC
Embargoed:


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


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 Radu Greab 2002-05-28 15:55:41 UTC
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 15:56:42 UTC
Created attachment 58767 [details]
Test code

Comment 2 Radu Greab 2002-05-28 15:58:09 UTC
Created attachment 58768 [details]
Proposed patch

Comment 3 Hui Huang 2002-09-19 21:27:20 UTC
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 21:35:02 UTC
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.