Program: 84939
Project: 84939
Buggy source:
@Override public void writeStatement(MethodWriter writer) throws BytecodeException {
  org.objectweb.asm.Label startLabel=this.startLabel.target=new org.objectweb.asm.Label();
  org.objectweb.asm.Label updateLabel=this.updateLabel.target=new org.objectweb.asm.Label();
  org.objectweb.asm.Label endLabel=this.endLabel.target=new org.objectweb.asm.Label();
  Variable var=this.variable;
  Variable arrayVar=this.arrayVar;
  Variable indexVar=this.indexVar;
  Variable lengthVar=this.lengthVar;
  org.objectweb.asm.Label scopeLabel=new org.objectweb.asm.Label();
  writer.writeLabel(scopeLabel);
  var.value.writeExpression(writer);
  int locals=writer.localCount();
  writer.writeInsn(Opcodes.DUP);
  arrayVar.writeInit(writer,null);
  writer.writeInsn(Opcodes.ARRAYLENGTH);
  lengthVar.writeInit(writer,null);
  writer.writeLDC(0);
  indexVar.writeInit(writer,null);
  writer.writeJumpInsn(Opcodes.GOTO,updateLabel);
  writer.writeTargetLabel(startLabel);
  arrayVar.writeGet(writer,null);
  indexVar.writeGet(writer,null);
  writer.writeInsn(var.type.getArrayLoadOpcode());
  var.writeInit(writer,null);
  if (this.action != null) {
    this.action.writeStatement(writer);
  }
  writer.writeIINC(indexVar.index,1);
  writer.writeLabel(updateLabel);
  indexVar.writeGet(writer,null);
  lengthVar.writeGet(writer,null);
  writer.writeJumpInsn(Opcodes.IF_ICMPLT,startLabel);
  writer.resetLocals(locals);
  writer.writeLabel(endLabel);
  var.writeLocal(writer,scopeLabel,endLabel);
  indexVar.writeLocal(writer,scopeLabel,endLabel);
  lengthVar.writeLocal(writer,scopeLabel,endLabel);
  arrayVar.writeLocal(writer,scopeLabel,endLabel);
}

Fixed version (ground truth):
@Override public void writeStatement(MethodWriter writer) throws BytecodeException {
  org.objectweb.asm.Label startLabel=this.startLabel.target=new org.objectweb.asm.Label();
  org.objectweb.asm.Label updateLabel=this.updateLabel.target=new org.objectweb.asm.Label();
  org.objectweb.asm.Label endLabel=this.endLabel.target=new org.objectweb.asm.Label();
  Variable var=this.variable;
  Variable arrayVar=this.arrayVar;
  Variable indexVar=this.indexVar;
  Variable lengthVar=this.lengthVar;
  org.objectweb.asm.Label scopeLabel=new org.objectweb.asm.Label();
  writer.writeLabel(scopeLabel);
  var.value.writeExpression(writer);
  int locals=writer.localCount();
  writer.writeInsn(Opcodes.DUP);
  arrayVar.writeInit(writer,null);
  writer.writeInsn(Opcodes.ARRAYLENGTH);
  writer.writeInsn(Opcodes.DUP);
  lengthVar.writeInit(writer,null);
  writer.writeLDC(0);
  indexVar.writeInit(writer,null);
  writer.writeJumpInsn(Opcodes.IFEQ,endLabel);
  writer.writeTargetLabel(startLabel);
  arrayVar.writeGet(writer,null);
  indexVar.writeGet(writer,null);
  writer.writeInsn(var.type.getArrayLoadOpcode());
  var.writeInit(writer,null);
  if (this.action != null) {
    this.action.writeStatement(writer);
  }
  writer.writeLabel(updateLabel);
  writer.writeIINC(indexVar.index,1);
  indexVar.writeGet(writer,null);
  lengthVar.writeGet(writer,null);
  writer.writeJumpInsn(Opcodes.IF_ICMPLT,startLabel);
  writer.resetLocals(locals);
  writer.writeLabel(endLabel);
  var.writeLocal(writer,scopeLabel,endLabel);
  indexVar.writeLocal(writer,scopeLabel,endLabel);
  lengthVar.writeLocal(writer,scopeLabel,endLabel);
  arrayVar.writeLocal(writer,scopeLabel,endLabel);
}