Patch: don't generate dead bytecode
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Tue Oct 9 08:16:00 GMT 2001
Per Bothner wrote:
> Folding a binary operator when both operand are constants is presumably
> safe - or are the some traps I'm not aware of?
Here's a case which we get wrong with -O. Note that if x and y are not
constant, it works correctly.
public class PR4822
{
public static void main(String[] args)
{
int x = 99;
int y = 0;
if ((x = y) == (99 - (y = 99)))
System.out.println ("OK");
else
System.out.println ("FAIL");
}
}
regards
Bryce.
More information about the Java-patches
mailing list