Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 61154 - int/unsigned int/long improperly compared
int/unsigned int/long improperly compared
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
alphaev6 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  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:
Last Closed: 2002-12-15 14:35:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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):

How reproducible:

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;
 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


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