Bug 61154 - int/unsigned int/long improperly compared
Summary: int/unsigned int/long improperly compared
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 7.1
Hardware: alphaev6 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL: http://bugzilla.mozilla.org/show_bug....
Depends On:
TreeView+ depends on / blocked
Reported: 2002-03-14 15:01 UTC by Andrew Schultz
Modified: 2007-04-18 16:40 UTC (History)
1 user (show)

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

Attachments (Terms of Use)

Description Andrew Schultz 2002-03-14 15:01:31 UTC
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 15:03:47 UTC
expected results: "LHS should always be GREATER than the RHS"

Comment 2 Mike Shaver 2002-03-14 15:15:46 UTC
As a data point, the test case works as expected on x86 gcc-2.96-98.

Comment 3 Alan Cox 2002-12-15 19:35:54 UTC
Confirmed also ok in 3.2

Comment 4 Andrew Schultz 2002-12-15 21:23:03 UTC
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.