Program: 25726
Project: 25726
Buggy source:
private int doOpcode148_201(int pos,byte[] code,int op) throws BadBytecode {
switch (op) {
case Opcode.LCMP:
    stackTypes[stackTop - 4]=INTEGER;
  stackTop-=3;
break;
case Opcode.FCMPL:
case Opcode.FCMPG:
stackTypes[--stackTop - 1]=INTEGER;
break;
case Opcode.DCMPL:
case Opcode.DCMPG:
stackTypes[stackTop - 4]=INTEGER;
stackTop-=3;
break;
case Opcode.IFEQ:
case Opcode.IFNE:
case Opcode.IFLT:
case Opcode.IFGE:
case Opcode.IFGT:
case Opcode.IFLE:
stackTop--;
visitBranch(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.IF_ICMPEQ:
case Opcode.IF_ICMPNE:
case Opcode.IF_ICMPLT:
case Opcode.IF_ICMPGE:
case Opcode.IF_ICMPGT:
case Opcode.IF_ICMPLE:
case Opcode.IF_ACMPEQ:
case Opcode.IF_ACMPNE:
stackTop-=2;
visitBranch(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.GOTO:
visitGoto(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.JSR:
stackTypes[stackTop++]=TOP;
visitJSR(pos,code);
return 3;
case Opcode.RET:
visitRET(pos,code);
return 2;
case Opcode.TABLESWITCH:
{
stackTop--;
int pos2=(pos & ~3) + 8;
int low=ByteArray.read32bit(code,pos2);
int high=ByteArray.read32bit(code,pos2 + 4);
int n=high - low + 1;
visitTableSwitch(pos,code,n,pos2 + 8,ByteArray.read32bit(code,pos2 - 4));
return n * 4 + 16 - (pos & 3);
}
case Opcode.LOOKUPSWITCH:
{
stackTop--;
int pos2=(pos & ~3) + 8;
int n=ByteArray.read32bit(code,pos2);
visitLookupSwitch(pos,code,n,pos2 + 4,ByteArray.read32bit(code,pos2 - 4));
return n * 8 + 12 - (pos & 3);
}
case Opcode.IRETURN:
stackTop--;
visitReturn(pos,code);
break;
case Opcode.LRETURN:
stackTop-=2;
visitReturn(pos,code);
break;
case Opcode.FRETURN:
stackTop--;
visitReturn(pos,code);
break;
case Opcode.DRETURN:
stackTop-=2;
visitReturn(pos,code);
break;
case Opcode.ARETURN:
TypeData.setType(stackTypes[--stackTop],returnType,classPool);
visitReturn(pos,code);
break;
case Opcode.RETURN:
visitReturn(pos,code);
break;
case Opcode.GETSTATIC:
return doGetField(pos,code,false);
case Opcode.PUTSTATIC:
return doPutField(pos,code,false);
case Opcode.GETFIELD:
return doGetField(pos,code,true);
case Opcode.PUTFIELD:
return doPutField(pos,code,true);
case Opcode.INVOKEVIRTUAL:
case Opcode.INVOKESPECIAL:
return doInvokeMethod(pos,code,true);
case Opcode.INVOKESTATIC:
return doInvokeMethod(pos,code,false);
case Opcode.INVOKEINTERFACE:
return doInvokeIntfMethod(pos,code);
case 186:
throw new RuntimeException("String_Node_Str");
case Opcode.NEW:
{
int i=ByteArray.readU16bit(code,pos + 1);
stackTypes[stackTop++]=new TypeData.UninitData(pos,cpool.getClassInfo(i));
return 3;
}
case Opcode.NEWARRAY:
return doNEWARRAY(pos,code);
case Opcode.ANEWARRAY:
{
int i=ByteArray.readU16bit(code,pos + 1);
String type=cpool.getClassInfo(i).replace('.','/');
if (type.charAt(0) == '[') type="String_Node_Str" + type;
 else type="String_Node_Str" + type + "String_Node_Str";
stackTypes[stackTop - 1]=new TypeData.ClassName(type);
return 3;
}
case Opcode.ARRAYLENGTH:
stackTypes[stackTop - 1]=INTEGER;
break;
case Opcode.ATHROW:
TypeData.setType(stackTypes[--stackTop],"String_Node_Str",classPool);
visitThrow(pos,code);
break;
case Opcode.CHECKCAST:
{
int i=ByteArray.readU16bit(code,pos + 1);
stackTypes[stackTop - 1]=new TypeData.ClassName(cpool.getClassInfo(i));
return 3;
}
case Opcode.INSTANCEOF:
stackTypes[stackTop - 1]=INTEGER;
return 3;
case Opcode.MONITORENTER:
case Opcode.MONITOREXIT:
stackTop--;
break;
case Opcode.WIDE:
return doWIDE(pos,code);
case Opcode.MULTIANEWARRAY:
return doMultiANewArray(pos,code);
case Opcode.IFNULL:
case Opcode.IFNONNULL:
stackTop--;
visitBranch(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.GOTO_W:
visitGoto(pos,code,ByteArray.read32bit(code,pos + 1));
return 5;
case Opcode.JSR_W:
stackTypes[stackTop++]=TOP;
visitJSR(pos,code);
return 5;
}
return 1;
}

Fixed version (ground truth):
private int doOpcode148_201(int pos,byte[] code,int op) throws BadBytecode {
switch (op) {
case Opcode.LCMP:
    stackTypes[stackTop - 4]=INTEGER;
  stackTop-=3;
break;
case Opcode.FCMPL:
case Opcode.FCMPG:
stackTypes[--stackTop - 1]=INTEGER;
break;
case Opcode.DCMPL:
case Opcode.DCMPG:
stackTypes[stackTop - 4]=INTEGER;
stackTop-=3;
break;
case Opcode.IFEQ:
case Opcode.IFNE:
case Opcode.IFLT:
case Opcode.IFGE:
case Opcode.IFGT:
case Opcode.IFLE:
stackTop--;
visitBranch(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.IF_ICMPEQ:
case Opcode.IF_ICMPNE:
case Opcode.IF_ICMPLT:
case Opcode.IF_ICMPGE:
case Opcode.IF_ICMPGT:
case Opcode.IF_ICMPLE:
case Opcode.IF_ACMPEQ:
case Opcode.IF_ACMPNE:
stackTop-=2;
visitBranch(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.GOTO:
visitGoto(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.JSR:
stackTypes[stackTop++]=TOP;
visitJSR(pos,code);
return 3;
case Opcode.RET:
visitRET(pos,code);
return 2;
case Opcode.TABLESWITCH:
{
stackTop--;
int pos2=(pos & ~3) + 8;
int low=ByteArray.read32bit(code,pos2);
int high=ByteArray.read32bit(code,pos2 + 4);
int n=high - low + 1;
visitTableSwitch(pos,code,n,pos2 + 8,ByteArray.read32bit(code,pos2 - 4));
return n * 4 + 16 - (pos & 3);
}
case Opcode.LOOKUPSWITCH:
{
stackTop--;
int pos2=(pos & ~3) + 8;
int n=ByteArray.read32bit(code,pos2);
visitLookupSwitch(pos,code,n,pos2 + 4,ByteArray.read32bit(code,pos2 - 4));
return n * 8 + 12 - (pos & 3);
}
case Opcode.IRETURN:
stackTop--;
visitReturn(pos,code);
break;
case Opcode.LRETURN:
stackTop-=2;
visitReturn(pos,code);
break;
case Opcode.FRETURN:
stackTop--;
visitReturn(pos,code);
break;
case Opcode.DRETURN:
stackTop-=2;
visitReturn(pos,code);
break;
case Opcode.ARETURN:
TypeData.setType(stackTypes[--stackTop],returnType,classPool);
visitReturn(pos,code);
break;
case Opcode.RETURN:
visitReturn(pos,code);
break;
case Opcode.GETSTATIC:
return doGetField(pos,code,false);
case Opcode.PUTSTATIC:
return doPutField(pos,code,false);
case Opcode.GETFIELD:
return doGetField(pos,code,true);
case Opcode.PUTFIELD:
return doPutField(pos,code,true);
case Opcode.INVOKEVIRTUAL:
case Opcode.INVOKESPECIAL:
return doInvokeMethod(pos,code,true);
case Opcode.INVOKESTATIC:
return doInvokeMethod(pos,code,false);
case Opcode.INVOKEINTERFACE:
return doInvokeIntfMethod(pos,code);
case 186:
throw new RuntimeException("String_Node_Str");
case Opcode.NEW:
{
int i=ByteArray.readU16bit(code,pos + 1);
stackTypes[stackTop++]=new TypeData.UninitData(pos,cpool.getClassInfo(i));
return 3;
}
case Opcode.NEWARRAY:
return doNEWARRAY(pos,code);
case Opcode.ANEWARRAY:
{
int i=ByteArray.readU16bit(code,pos + 1);
String type=cpool.getClassInfo(i).replace('.','/');
if (type.charAt(0) == '[') type="String_Node_Str" + type;
 else type="String_Node_Str" + type + "String_Node_Str";
stackTypes[stackTop - 1]=new TypeData.ClassName(type);
return 3;
}
case Opcode.ARRAYLENGTH:
TypeData.setType(stackTypes[stackTop - 1],"String_Node_Str",classPool);
stackTypes[stackTop - 1]=INTEGER;
break;
case Opcode.ATHROW:
TypeData.setType(stackTypes[--stackTop],"String_Node_Str",classPool);
visitThrow(pos,code);
break;
case Opcode.CHECKCAST:
{
int i=ByteArray.readU16bit(code,pos + 1);
stackTypes[stackTop - 1]=new TypeData.ClassName(cpool.getClassInfo(i));
return 3;
}
case Opcode.INSTANCEOF:
stackTypes[stackTop - 1]=INTEGER;
return 3;
case Opcode.MONITORENTER:
case Opcode.MONITOREXIT:
stackTop--;
break;
case Opcode.WIDE:
return doWIDE(pos,code);
case Opcode.MULTIANEWARRAY:
return doMultiANewArray(pos,code);
case Opcode.IFNULL:
case Opcode.IFNONNULL:
stackTop--;
visitBranch(pos,code,ByteArray.readS16bit(code,pos + 1));
return 3;
case Opcode.GOTO_W:
visitGoto(pos,code,ByteArray.read32bit(code,pos + 1));
return 5;
case Opcode.JSR_W:
stackTypes[stackTop++]=TOP;
visitJSR(pos,code);
return 5;
}
return 1;
}