Program: 79500
Project: 79500
Buggy source:
private void processCmpBinaryOp(BinaryExprNode node){
  if (node.getLhs().getType() instanceof StringType) {
    processStringBinaryOp(node);
    return;
  }
  node.getLhs().accept(this);
  node.getRhs().accept(this);
  RegValue lhs=node.getLhs().getRegValue(), rhs=node.getRhs().getRegValue(), tmp;
  boolean bothConst=lhs instanceof IntImmediate && rhs instanceof IntImmediate;
  int lhsImm=0, rhsImm=0;
  if (lhs instanceof IntImmediate)   lhsImm=((IntImmediate)lhs).getValue();
  if (rhs instanceof IntImmediate)   rhsImm=((IntImmediate)rhs).getValue();
  IRComparison.IRCmpOp op;
switch (node.getOp()) {
case GREATER:
    op=IRComparison.IRCmpOp.GREATER;
  if (bothConst) {
    if (lhsImm > rhsImm)     node.setRegValue(new IntImmediate(1));
 else     node.setRegValue(new IntImmediate(0));
    return;
  }
break;
case LESS:
op=IRComparison.IRCmpOp.LESS;
if (bothConst) {
if (lhsImm < rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
break;
case GREATER_EQUAL:
op=IRComparison.IRCmpOp.GREATER_EQUAL;
if (bothConst) {
if (lhsImm >= rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
break;
case LESS_EQUAL:
op=IRComparison.IRCmpOp.LESS_EQUAL;
if (bothConst) {
if (lhsImm <= rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
break;
case EQUAL:
op=IRComparison.IRCmpOp.EQUAL;
if (bothConst) {
if (lhsImm == rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
break;
case INEQUAL:
op=IRComparison.IRCmpOp.INEQUAL;
if (bothConst) {
if (lhsImm != rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
break;
default :
throw new CompilerError("String_Node_Str");
}
VirtualRegister vreg=new VirtualRegister(null);
currentBB.addInst(new IRComparison(currentBB,vreg,op,lhs,rhs));
if (node.getTrueBB() != null) {
currentBB.setJumpInst(new IRBranch(currentBB,vreg,node.getTrueBB(),node.getFalseBB()));
}
 else {
node.setRegValue(vreg);
}
}

Fixed version (ground truth):
private void processCmpBinaryOp(BinaryExprNode node){
  if (node.getLhs().getType() instanceof StringType) {
    processStringBinaryOp(node);
    return;
  }
  node.getLhs().accept(this);
  node.getRhs().accept(this);
  RegValue lhs=node.getLhs().getRegValue(), rhs=node.getRhs().getRegValue(), tmp;
  boolean bothConst=lhs instanceof IntImmediate && rhs instanceof IntImmediate;
  int lhsImm=0, rhsImm=0;
  if (lhs instanceof IntImmediate)   lhsImm=((IntImmediate)lhs).getValue();
  if (rhs instanceof IntImmediate)   rhsImm=((IntImmediate)rhs).getValue();
  IRComparison.IRCmpOp op;
switch (node.getOp()) {
case GREATER:
    op=IRComparison.IRCmpOp.GREATER;
  if (bothConst) {
    if (lhsImm > rhsImm)     node.setRegValue(new IntImmediate(1));
 else     node.setRegValue(new IntImmediate(0));
    return;
  }
if (lhs instanceof IntImmediate) {
  tmp=rhs;
  rhs=lhs;
  lhs=tmp;
  op=IRComparison.IRCmpOp.LESS;
}
break;
case LESS:
op=IRComparison.IRCmpOp.LESS;
if (bothConst) {
if (lhsImm < rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
if (lhs instanceof IntImmediate) {
tmp=rhs;
rhs=lhs;
lhs=tmp;
op=IRComparison.IRCmpOp.GREATER;
}
break;
case GREATER_EQUAL:
op=IRComparison.IRCmpOp.GREATER_EQUAL;
if (bothConst) {
if (lhsImm >= rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
if (lhs instanceof IntImmediate) {
tmp=rhs;
rhs=lhs;
lhs=tmp;
op=IRComparison.IRCmpOp.LESS_EQUAL;
}
break;
case LESS_EQUAL:
op=IRComparison.IRCmpOp.LESS_EQUAL;
if (bothConst) {
if (lhsImm <= rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
if (lhs instanceof IntImmediate) {
tmp=rhs;
rhs=lhs;
lhs=tmp;
op=IRComparison.IRCmpOp.GREATER_EQUAL;
}
break;
case EQUAL:
op=IRComparison.IRCmpOp.EQUAL;
if (bothConst) {
if (lhsImm == rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
if (lhs instanceof IntImmediate) {
tmp=rhs;
rhs=lhs;
lhs=tmp;
}
break;
case INEQUAL:
op=IRComparison.IRCmpOp.INEQUAL;
if (bothConst) {
if (lhsImm != rhsImm) node.setRegValue(new IntImmediate(1));
 else node.setRegValue(new IntImmediate(0));
return;
}
if (lhs instanceof IntImmediate) {
tmp=rhs;
rhs=lhs;
lhs=tmp;
}
break;
default :
throw new CompilerError("String_Node_Str");
}
VirtualRegister vreg=new VirtualRegister(null);
currentBB.addInst(new IRComparison(currentBB,vreg,op,lhs,rhs));
if (node.getTrueBB() != null) {
currentBB.setJumpInst(new IRBranch(currentBB,vreg,node.getTrueBB(),node.getFalseBB()));
}
 else {
node.setRegValue(vreg);
}
}