Bug 1498 - Wrong result for some integer divisions on Alpha
Summary: Wrong result for some integer divisions on Alpha
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.5
: P2 normal
Target Milestone: ---
Assignee: Roland McGrath
URL:
Keywords:
Depends on:
Blocks: libc236
  Show dependency treegraph
 
Reported: 2005-10-18 20:46 UTC by Falk Hueffner
Modified: 2016-05-17 18:34 UTC (History)
1 user (show)

See Also:
Host:
Target: alpha-*-*
Build:
Last reconfirmed:
fweimer: security-


Attachments
patch (572 bytes, patch)
2005-10-18 20:47 UTC, Falk Hueffner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Falk Hueffner 2005-10-18 20:46:33 UTC
When x has bit 63 set, then the unsigned integer division x/x will give 0
instead of 1. This is due to a typo in __divqu. The same problem exists in 
__remqu. This breaks gmp (see http://bugs.debian.org/324455). The attached
patch fixes it. This patch has been in use in Debian's glibc for a while.
Comment 1 Falk Hueffner 2005-10-18 20:47:04 UTC
Created attachment 721 [details]
patch
Comment 2 Richard Henderson 2005-10-18 20:58:44 UTC
The patch is correct.  I asked Falk to open the PR for Roland and the 2.3 branch.
Comment 3 Ulrich Drepper 2005-10-20 05:25:56 UTC
Fixed on the trunk.  Possibly for the 2.3 branch.
Comment 4 cvs-commit@gcc.gnu.org 2005-10-23 00:52:04 UTC
Subject: Bug 1498

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-10-23 00:52:00

Modified files:
	sysdeps/alpha  : divqu.S remqu.S 

Log message:
	2005-08-23  GOTO Masanori  <gotom@debian.or.jp>
	
	[BZ #1498]
	* sysdeps/alpha/remqu.S: Return the correct result when the same
	dividend and divisor are provided, and they're negative numbers.
	* sysdeps/alpha/divqu.S: Likewise.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/alpha/divqu.S.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.8&r2=1.8.4.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/alpha/remqu.S.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.10&r2=1.10.4.1

Comment 5 GOTO Masanori 2005-10-29 05:47:20 UTC
Thanks for your catching up to apply the patch.
Comment 6 Roland McGrath 2005-11-04 21:43:39 UTC
This bug should be fixed in the 2.3.6 release just made.