Program: 6372
Project: 6372
Buggy source:
/** 
 * Control flow analysis for one nonabstract-method.
 */
public void controlFlowGraph(){
  cpg=new ConstantPoolGen(jc.getConstantPool());
  InstConstraintVisitor icv=new AnInstConstraintVisitor();
  icv.setConstantPoolGen(cpg);
  ExecutionVisitor ev=new ExecutionVisitor();
  ev.setConstantPoolGen(cpg);
  mg=new MethodGen(methodbcel,jc.getClassName(),cpg);
  mg.getInstructionList().setPositions(true);
  icv.setMethodGen(mg);
  if (!(mg.isAbstract() || mg.isNative())) {
    InstructionHandle ih=mg.getInstructionList().getStart();
    InstructionHandle ihend=mg.getInstructionList().getEnd();
    init(ih,ihend);
    do {
      Instruction ins=ih.getInstruction();
      if (ih.getInstruction() instanceof BranchInstruction) {
        InstructionHandle ihtar=((BranchInstruction)ih.getInstruction()).getTarget();
        InstructionHandle ihnext=ih.getNext();
        createBasicBlock(ihtar);
        if (ihnext != null) {
          createBasicBlock(ihnext);
        }
      }
    }
 while ((ih=ih.getNext()) != null);
    int id=0;
    for (Iterator iter=getBbs().keySet().iterator(); iter.hasNext(); ) {
      WCETBasicBlock wbb=(WCETBasicBlock)getBbs().get((Integer)iter.next());
      wbb.calculateWcet();
      wbb.setId(id);
      id++;
      ih=wbb.getEndih();
      WCETBasicBlock wbbthis=getCoveringBB(ih);
      if (ih.getInstruction() instanceof BranchInstruction) {
        InstructionHandle ihtar=((BranchInstruction)ih.getInstruction()).getTarget();
        WCETBasicBlock wbbtar=getCoveringBB(ihtar);
        wbbthis.setTarbb(wbbtar);
        wbbtar.addTargeter(wbbthis);
        if (ih.getInstruction() instanceof IfInstruction) {
          InstructionHandle ihnext=ih.getNext();
          if (ihnext != null) {
            WCETBasicBlock wbbnxt=getCoveringBB(ihnext);
            wbbthis.setSucbb(wbbnxt);
          }
        }
      }
 else {
        InstructionHandle ihnext=ih.getNext();
        if (ihnext != null) {
          WCETBasicBlock wbbnxt=getCoveringBB(ihnext);
          wbbthis.setSucbb(wbbnxt);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Control flow analysis for one nonabstract-method.
 */
public void controlFlowGraph(){
  cpg=new ConstantPoolGen(jc.getConstantPool());
  InstConstraintVisitor icv=new AnInstConstraintVisitor();
  icv.setConstantPoolGen(cpg);
  ExecutionVisitor ev=new ExecutionVisitor();
  ev.setConstantPoolGen(cpg);
  mg=new MethodGen(methodbcel,jc.getClassName(),cpg);
  mg.getInstructionList().setPositions(true);
  icv.setMethodGen(mg);
  if (!(mg.isAbstract() || mg.isNative())) {
    InstructionHandle ih=mg.getInstructionList().getStart();
    InstructionHandle ihend=mg.getInstructionList().getEnd();
    init(ih,ihend);
    do {
      Instruction ins=ih.getInstruction();
      if (ih.getInstruction() instanceof BranchInstruction) {
        InstructionHandle ihtar=((BranchInstruction)ih.getInstruction()).getTarget();
        InstructionHandle ihnext=ih.getNext();
        createBasicBlock(ihtar);
        if (ihnext != null) {
          createBasicBlock(ihnext);
        }
      }
    }
 while ((ih=ih.getNext()) != null);
    int id=0;
    for (Iterator iter=getBbs().keySet().iterator(); iter.hasNext(); ) {
      WCETBasicBlock wbb=(WCETBasicBlock)getBbs().get((Integer)iter.next());
      wbb.calculateWcet();
      wbb.setId(id);
      id++;
      ih=wbb.getEndih();
      WCETBasicBlock wbbthis=getCoveringBB(ih);
      if (ih.getInstruction() instanceof BranchInstruction) {
        InstructionHandle ihtar=((BranchInstruction)ih.getInstruction()).getTarget();
        WCETBasicBlock wbbtar=getCoveringBB(ihtar);
        wbbthis.setTarbb(wbbtar);
        wbbtar.addTargeter(wbbthis);
        if (ih.getInstruction() instanceof IfInstruction) {
          InstructionHandle ihnext=ih.getNext();
          if (ihnext != null) {
            WCETBasicBlock wbbnxt=getCoveringBB(ihnext);
            wbbthis.setSucbb(wbbnxt);
          }
        }
      }
 else       if (ih.getInstruction() instanceof ReturnInstruction) {
      }
 else {
        InstructionHandle ihnext=ih.getNext();
        if (ihnext != null) {
          WCETBasicBlock wbbnxt=getCoveringBB(ihnext);
          wbbthis.setSucbb(wbbnxt);
        }
      }
    }
  }
}