This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: don't generate dead bytecode
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.