[Bug c/12654] [3.3/3.4 regression] Incorrect comparison code generated for Alpha

falk at debian dot org gcc-bugzilla@gcc.gnu.org
Fri Oct 17 09:52:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12654


falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
            Summary|Incorrect comparison code   |[3.3/3.4 regression]
                   |generated for Alpha         |Incorrect comparison code
                   |                            |generated for Alpha


------- Additional Comments From falk at debian dot org  2003-10-17 08:52 -------
This boils down to 

foo(MIN_LONG)

(the posted test case is technically invalid).

It is caused by gcc generating

lda     v0,-1023(a0)
cmplt   zero,v0,v0

instead of

lda     v0,1024
cmple   v0,a0,v0

Happens only in some contexts, e.g. for

int foo (long x) { if (x >= 1024) return 1; else return 0; }

but not for

int bar (long x) { return x >= 1024; }

gcc 2.95 got it right, 3.2 not. Probably target dependent, but I don't have 
anything else to test currently.

The bogus variant is actually slightly better WRT register pressure, so we
might want to retain it for int arguments.



More information about the Gcc-bugs mailing list