This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bad code with optimization
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: Bad code with optimization
- From: Antonio Ake <ake at ecn dot purdue dot edu>
- Date: Wed, 7 Nov 2001 12:18:51 -0500 (EST)
Hello, This program doesn't work with -O1 and -O2 flags. But when it is
compiled with -O0, then the program runs succesfully.
I have done more testing and this is also a problem with gcc and a C
program.
public class Test {
public static void main(String [] args) {
int i,jjnewStateCnt,startsAt,curPos;
curPos=1;
i=67;
startsAt=67;
jjnewStateCnt=0;
if ((i = jjnewStateCnt) == (startsAt = 67 - (jjnewStateCnt =
startsAt))){
System.err.println("OK "+ "\n");
return;
}
System.out.println("\nERROR\n");
return;
}
}