Buggy code:
public class BinaryExpressionMultiTypeDispatcher extends BinaryExpressionHelper { private static class BinaryCharExpressionHelper extends BinaryIntExpressionHelper { public BinaryCharExpressionHelper ( WriterController wc ) { } private static final MethodCaller charArrayGet = MethodCaller . newStatic ( BytecodeInterface8 . class , "cArrayGet" ) ; private static final MethodCaller charArraySet = MethodCaller . newStatic ( BytecodeInterface8 . class , "cArraySet" ) ; @ Override protected MethodCaller getArrayGetCaller ( ) { } @ Override protected ClassNode getArrayGetResultType ( ) { } @ Override protected MethodCaller getArraySetCaller ( ) { } } private static class BinaryByteExpressionHelper extends BinaryIntExpressionHelper { public BinaryByteExpressionHelper ( WriterController wc ) { } private static final MethodCaller byteArrayGet = MethodCaller . newStatic ( BytecodeInterface8 . class , "bArrayGet" ) ; private static final MethodCaller byteArraySet = MethodCaller . newStatic ( BytecodeInterface8 . class , "bArraySet" ) ; @ Override protected MethodCaller getArrayGetCaller ( ) { } @ Override protected ClassNode getArrayGetResultType ( ) { } @ Override protected MethodCaller getArraySetCaller ( ) { } } private static class BinaryShortExpressionHelper extends BinaryIntExpressionHelper { public BinaryShortExpressionHelper ( WriterController wc ) { } private static final MethodCaller shortArrayGet = MethodCaller . newStatic ( BytecodeInterface8 . class , "sArrayGet" ) ; private static final MethodCaller shortArraySet = MethodCaller . newStatic ( BytecodeInterface8 . class , "sArraySet" ) ; @ Override protected MethodCaller getArrayGetCaller ( ) { } @ Override protected ClassNode getArrayGetResultType ( ) { } @ Override protected MethodCaller getArraySetCaller ( ) { } } private BinaryExpressionWriter [ ] binExpWriter = new BinaryExpressionWriter [ ] { new BinaryObjectExpressionHelper ( getController ( ) ) , new BinaryIntExpressionHelper ( getController ( ) ) , new BinaryLongExpressionHelper ( getController ( ) ) , new BinaryDoubleExpressionHelper ( getController ( ) ) , new BinaryExpressionMultiTypeDispatcher . BinaryCharExpressionHelper ( getController ( ) ) , new BinaryExpressionMultiTypeDispatcher . BinaryByteExpressionHelper ( getController ( ) ) , new BinaryExpressionMultiTypeDispatcher . BinaryShortExpressionHelper ( getController ( ) ) , new BinaryFloatExpressionHelper ( getController ( ) ) , new BinaryBooleanExpressionHelper ( getController ( ) ) } ; public static Map < ClassNode , Integer > typeMap = new HashMap < ClassNode , Integer > ( 14 ) ; public static final String [ ] typeMapKeyNames = new String [ ] { "dummy" , "int" , "long" , "double" , "char" , "byte" , "short" , "float" , "boolean" } ; public BinaryExpressionMultiTypeDispatcher ( WriterController wc ) { } private int getOperandConversionType ( ClassNode leftType , ClassNode rightType ) { } private int getOperandType ( ClassNode type ) { } @ Override protected void evaluateCompareExpression ( final MethodCaller compareMethod , BinaryExpression binExp ) { } @ Override protected void evaluateBinaryExpression ( final String message , BinaryExpression binExp ) { } private boolean isIntCastableType ( Expression rightExp ) { } private boolean isShiftOperation ( int operation ) { } private boolean isAssignmentToArray ( BinaryExpression binExp ) { } private int removeAssignment ( int op ) { } private boolean doAssignmentToArray ( BinaryExpression binExp ) { if ( ! ( isAssignmentToArray ( binExp ) ) ) return false ; int operation = removeAssignment ( binExp . getOperation ( ) . getType ( ) ) ; ClassNode current = getController ( ) . getClassNode ( ) ; Expression leftExp = binExp . getLeftExpression ( ) ; ClassNode leftType = getController ( ) . getTypeChooser ( ) . resolveType ( leftExp , current ) ; Expression rightExp = binExp . getRightExpression ( ) ; ClassNode rightType = getController ( ) . getTypeChooser ( ) . resolveType ( rightExp , current ) ; int operationType = getOperandConversionType ( leftType , rightType ) ; BinaryExpressionWriter bew = binExpWriter [ operationType ] ; boolean simulationSuccess = bew . arrayGet ( LEFT_SQUARE_BRACKET , true ) ; simulationSuccess = simulationSuccess && ( bew . write ( operation , true ) ) ; simulationSuccess = simulationSuccess && ( bew . arraySet ( true ) ) ; if ( ! simulationSuccess ) return false ; AsmClassGenerator acg = getController ( ) . getAcg ( ) ; OperandStack operandStack = getController ( ) . getOperandStack ( ) ; CompileStack compileStack = getController ( ) . getCompileStack ( ) ; BinaryExpression arrayWithSubscript = ( ( BinaryExpression ) ( leftExp ) ) ; Expression subscript = arrayWithSubscript . getRightExpression ( ) ; subscript . visit ( acg ) ; operandStack . doGroovyCast ( int_TYPE ) ; int subscriptValueId = compileStack . defineTemporaryVariable ( "$sub" , int_TYPE , true ) ; arrayWithSubscript . getLeftExpression ( ) . visit ( acg ) ; operandStack . dup ( ) ; operandStack . load ( int_TYPE , subscriptValueId ) ; bew . arrayGet ( LEFT_SQUARE_BRACKET , false ) ; operandStack . replace ( leftType , 2 ) ; binExp . getRightExpression ( ) . visit ( acg ) ; bew . write ( operation , false ) ; operandStack . dup ( ) ; int resultValueId = compileStack . defineTemporaryVariable ( "$result" , rightType , true ) ; operandStack . load ( int_TYPE , subscriptValueId ) ; operandStack . swap ( ) ; bew . arraySet ( false ) ; <START_BUG> operandStack . remove ( 2 ) ; <END_BUG> operandStack . load ( rightType , resultValueId ) ; compileStack . removeVar ( resultValueId ) ; compileStack . removeVar ( subscriptValueId ) ; return true ; } @ Override protected void evaluateBinaryExpressionWithAssignment ( String method , BinaryExpression binExp ) { } private boolean doAssignmentToLocalVariable ( String method , BinaryExpression binExp ) { } @ Override protected void assignToArray ( Expression orig , Expression receiver , Expression index , Expression rhsValueLoader ) { } @ Override protected void writePostOrPrefixMethod ( int op , String method , Expression expression , Expression orig ) { } }

Fix:
operandStack . remove ( 3 ) ;