comparisons..

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed Jul 12 23:54:00 GMT 2000


> unsigned long x;
>  
> int y()
> {
>         return (x < 0);
> }
> 
> This is usually a bug.  Is there a way of getting gcc to warn about it?

GCC knows exactly that the expression is zero; with -O2
-fomit-frame-pointer, it generates

y:
	xorl %eax,%eax
	ret

However, what exactly is the "usual" bug here? That an expression can
be computed statically? 

Regards,
Martin



More information about the Gcc mailing list