Bug 61154 - int/unsigned int/long improperly compared
int/unsigned int/long improperly compared
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
alphaev6 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
http://bugzilla.mozilla.org/show_bug....
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-03-14 10:01 EST by Andrew Schultz
Modified: 2007-04-18 12:40 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 14:35:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Andrew Schultz 2002-03-14 10:01:31 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux alpha; en-US; rv:0.9.8) Gecko/20020205

Description of problem:
The proper combination of unsigned int, int and long in a comparison produces
the wrong result.

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

How reproducible:
Always

Steps to Reproduce:
1.compile test program and run



Actual Results:  output: "oops1"
In one case, the LHS is less than the RHS

Expected Results:  output: ""
the LHS should always be less than the RHS

Additional info:

#include <stdio.h>

int main()
{
 int i=1073741825;
 long j=1073741823;
 unsigned int k;
 k=i+j;
 if ((unsigned int)(i+j) <= 2*(long)1073741823) {printf ("oops1\n");}
 if ((unsigned int)(i+j) <= 2*1073741823) {printf ("oops2\n");}
 if (k <= 2*(long)1073741823) {printf ("oops3\n");}
 return 0;
}
Comment 1 Andrew Schultz 2002-03-14 10:03:47 EST
expected results: "LHS should always be GREATER than the RHS"
Comment 2 Mike Shaver 2002-03-14 10:15:46 EST
As a data point, the test case works as expected on x86 gcc-2.96-98.
Comment 3 Alan Cox 2002-12-15 14:35:54 EST
Confirmed also ok in 3.2
Comment 4 Andrew Schultz 2002-12-15 16:23:03 EST
this has always been alpha only and has now been reported to compaq as it still
exists with 7.2

http://alpha.crl.dec.com/bugzilla/show_bug.cgi?id=32

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