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; }
expected results: "LHS should always be GREATER than the RHS"
As a data point, the test case works as expected on x86 gcc-2.96-98.
Confirmed also ok in 3.2
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