another silly optimisation case

Joern Rennecke amylaar@cygnus.co.uk
Wed Mar 10 10:48:00 GMT 1999


> Hi,
> 
> egcs RH5.2 (egcs-2.90.27 980315 (egcs-1.0.2 release))
> generates different code for these two functions, the
> first including a jump even with -O6:
> 
> int f(int g) { return g ? 34 : 0; }
> 
> int g(int f) { return f && 34; }
> 
> I don't suppose (x ? y : 0) is a hugely common construction
> but it seems to be another candidate for simple optimisation.
> 
> Am I missing something about what the standard says about
> these two operators?

f (1) returns 34.
g (1) returns 1.


More information about the Gcc mailing list