This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bad code with optimization



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;



    }
  }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]