nus-yam/ex-repair huggingface dataset:
Program: 79491
Project: 79491
Buggy source:
public void compile() throws Exception {
  buildAST();
  if (astOutS != null)   new ASTPrinter(astOutS).visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  IRRoot ir=irBuilder.getIR();
  new TwoRegOpTransformer(ir).run();
  if (Configuration.isEnableFunctionInline())   new FunctionInlineProcessor(ir).run();
  if (irOutS != null)   new IRPrinter(irOutS).visit(ir);
  new StaticDataProcessor(ir).run();
  new RegLivelinessAnalysis(ir).run();
  new RegisterPreprocessor(ir).run();
  new RegisterAllocator(ir,NASMRegisterSet.generalRegs).run();
  new NASMTransformer(ir).run();
  new NASMPrinter(nasmOutS).visit(ir);
}

Fixed version (ground truth):
public void compile() throws Exception {
  buildAST();
  if (astOutS != null)   new ASTPrinter(astOutS).visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  IRRoot ir=irBuilder.getIR();
  new TwoRegOpTransformer(ir).run();
  if (Configuration.isEnableFunctionInline())   new FunctionInlineProcessor(ir).run();
  if (irOutS != null)   new IRPrinter(irOutS).visit(ir);
  new StaticDataProcessor(ir).run();
  new RegisterPreprocessor(ir).run();
  new RegLivelinessAnalysis(ir).run();
  new RegisterAllocator(ir,NASMRegisterSet.generalRegs).run();
  new NASMTransformer(ir).run();
  new NASMPrinter(nasmOutS).visit(ir);
}
Program: 79493
Project: 79493
Buggy source:
public void addInst(IRInstruction inst){
  if (hasJumpInst) {
    throw new CompilerError("String_Node_Str");
  }
  if (lastInst == null) {
    firstInst=lastInst=inst;
  }
 else {
    lastInst.linkNextInst(inst);
    lastInst=inst;
  }
}

Fixed version (ground truth):
public void addInst(IRInstruction inst){
  if (hasJumpInst) {
    throw new CompilerError("String_Node_Str");
  }
  if (firstInst == null) {
    firstInst=lastInst=inst;
  }
 else {
    lastInst.linkNextInst(inst);
    lastInst=inst;
  }
}
Program: 79495
Project: 79495
Buggy source:
public NASMRegister(String name,boolean isGeneral,boolean isCallerSave,boolean isCalleeSave){
  this.name=name;
  this.isGeneral=isGeneral;
  this.isCallerSave=isCallerSave;
  this.isCalleeSave=isCalleeSave;
}

Fixed version (ground truth):
public NASMRegister(String name,boolean isGeneral,boolean isCallerSave,boolean isCalleeSave,int arg6Idx){
  this.name=name;
  this.isGeneral=isGeneral;
  this.isCallerSave=isCallerSave;
  this.isCalleeSave=isCalleeSave;
  this.arg6Idx=arg6Idx;
}
Program: 79501
Project: 79501
Buggy source:
public static void main(String[] args) throws Exception {
  String inFile=null, astOutFile=null, irOutFile=null, nasmOutFile=null;
  boolean isPrintHelp=false, isPrintVersion=false, isPrintConfig=false;
  for (int i=0; i < args.length; ++i) {
    String arg=args[i];
switch (arg) {
case "String_Node_Str":
case "String_Node_Str":
      isPrintHelp=true;
    break;
case "String_Node_Str":
case "String_Node_Str":
  isPrintVersion=true;
break;
case "String_Node_Str":
case "String_Node_Str":
isPrintConfig=true;
break;
case "String_Node_Str":
if (i + 1 < args.length) nasmOutFile=args[++i];
 else errorArgs();
break;
default :
if (inFile == null) inFile=arg;
 else errorArgs();
}
}
if (isPrintVersion) printVersion();
if (isPrintHelp) printHelp();
if (isPrintConfig) printConfig();
irOutFile="String_Node_Str";
InputStream inS;
PrintStream astOutS, irOutS, nasmOutS;
if (inFile == null) inS=System.in;
 else inS=new FileInputStream(inFile);
if (astOutFile == null) astOutS=null;
 else astOutS=new PrintStream(new FileOutputStream(astOutFile));
if (irOutFile == null) irOutS=null;
 else irOutS=new PrintStream(new FileOutputStream(irOutFile));
if (nasmOutFile == null) nasmOutS=System.out;
 else nasmOutS=new PrintStream(new FileOutputStream(nasmOutFile));
Compiler compiler=new Compiler(inS,astOutS,irOutS,nasmOutS);
try {
compiler.compile();
}
 catch (Error e) {
System.err.println(e.getMessage());
System.exit(1);
}
LLIRInterpreter leLeIRInterpreter=new LLIRInterpreter(new FileInputStream(irOutFile),false);
leLeIRInterpreter.run();
System.out.println("String_Node_Str" + leLeIRInterpreter.getExitcode());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String inFile=null, astOutFile=null, irOutFile=null, nasmOutFile=null;
  boolean isPrintHelp=false, isPrintVersion=false, isPrintConfig=false;
  for (int i=0; i < args.length; ++i) {
    String arg=args[i];
switch (arg) {
case "String_Node_Str":
case "String_Node_Str":
      isPrintHelp=true;
    break;
case "String_Node_Str":
case "String_Node_Str":
  isPrintVersion=true;
break;
case "String_Node_Str":
case "String_Node_Str":
isPrintConfig=true;
break;
case "String_Node_Str":
if (i + 1 < args.length) nasmOutFile=args[++i];
 else errorArgs();
break;
default :
if (inFile == null) inFile=arg;
 else errorArgs();
}
}
if (isPrintVersion) printVersion();
if (isPrintHelp) printHelp();
if (isPrintConfig) printConfig();
InputStream inS;
PrintStream astOutS, irOutS, nasmOutS;
if (inFile == null) inS=System.in;
 else inS=new FileInputStream(inFile);
if (astOutFile == null) astOutS=null;
 else astOutS=new PrintStream(new FileOutputStream(astOutFile));
if (irOutFile == null) irOutS=null;
 else irOutS=new PrintStream(new FileOutputStream(irOutFile));
if (nasmOutFile == null) nasmOutS=System.out;
 else nasmOutS=new PrintStream(new FileOutputStream(nasmOutFile));
Compiler compiler=new Compiler(inS,astOutS,irOutS,nasmOutS);
try {
compiler.compile();
}
 catch (Error e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Program: 79504
Project: 79504
Buggy source:
private String sizeStr(int memSize){
  String sizeStr;
switch (memSize) {
case 1:
    sizeStr="String_Node_Str";
  break;
case 2:
sizeStr="String_Node_Str";
break;
case 4:
sizeStr="String_Node_Str";
break;
case 8:
sizeStr="String_Node_Str";
break;
default :
throw new CompilerError("String_Node_Str");
}
return sizeStr;
}

Fixed version (ground truth):
private String sizeStr(int memSize){
  String sizeStr;
switch (memSize) {
case 1:
    sizeStr="String_Node_Str";
  break;
case 2:
sizeStr="String_Node_Str";
break;
case 4:
sizeStr="String_Node_Str";
break;
case 8:
sizeStr="String_Node_Str";
break;
default :
throw new CompilerError("String_Node_Str" + memSize);
}
return sizeStr;
}
Program: 79506
Project: 79506
Buggy source:
public void compile() throws Exception {
  buildAST();
  if (astOutS != null)   new ASTPrinter(astOutS).visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  IRRoot ir=irBuilder.getIR();
  new TwoRegOpTransformer(ir).run();
  if (Configuration.isEnableFunctionInline())   new FunctionInlineProcessor(ir).run();
  if (irOutS != null)   new IRPrinter(irOutS).visit(ir);
  new StaticDataProcessor(ir).run();
  new RegisterPreprocessor(ir).run();
  new RegLivelinessAnalysis(ir).run();
  new RegisterAllocator(ir,NASMRegisterSet.generalRegs).run();
  new NASMTransformer(ir).run();
  new NASMPrinter(nasmOutS).visit(ir);
}

Fixed version (ground truth):
public void compile() throws Exception {
  buildAST();
  if (astOutS != null)   new ASTPrinter(astOutS).visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  IRRoot ir=irBuilder.getIR();
  System.err.println("String_Node_Str");
  new TwoRegOpTransformer(ir).run();
  System.err.println("String_Node_Str");
  if (Configuration.isEnableFunctionInline())   new FunctionInlineProcessor(ir).run();
  if (irOutS != null)   new IRPrinter(irOutS).visit(ir);
  new StaticDataProcessor(ir).run();
  System.err.println("String_Node_Str");
  new RegisterPreprocessor(ir).run();
  System.err.println("String_Node_Str");
  new RegLivelinessAnalysis(ir).run();
  System.err.println("String_Node_Str");
  new RegisterAllocator(ir,NASMRegisterSet.generalRegs).run();
  System.err.println("String_Node_Str");
  new NASMTransformer(ir).run();
  System.err.println("String_Node_Str");
  new NASMPrinter(nasmOutS).visit(ir);
}
Program: 79507
Project: 79507
Buggy source:
private void processIRAssign(RegValue dest,int addrOffset,ExprNode rhs,int size,boolean needMemOp){
  if (rhs.getTrueBB() != null) {
    BasicBlock mergeBB=new BasicBlock(currentFunc,null);
    if (needMemOp) {
      rhs.getTrueBB().addInst(new IRStore(rhs.getTrueBB(),new IntImmediate(1),BoolType.getInstance().getVarSize(),dest,addrOffset));
      rhs.getFalseBB().addInst(new IRStore(rhs.getFalseBB(),new IntImmediate(0),BoolType.getInstance().getVarSize(),dest,addrOffset));
    }
 else {
      rhs.getTrueBB().addInst(new IRMove(rhs.getTrueBB(),(VirtualRegister)dest,new IntImmediate(1)));
      rhs.getFalseBB().addInst(new IRMove(rhs.getFalseBB(),(VirtualRegister)dest,new IntImmediate(0)));
    }
    if (!rhs.getTrueBB().isHasJumpInst())     rhs.getTrueBB().setJumpInst(new IRJump(rhs.getTrueBB(),mergeBB));
    if (!rhs.getFalseBB().isHasJumpInst())     rhs.getFalseBB().setJumpInst(new IRJump(rhs.getFalseBB(),mergeBB));
    currentBB=mergeBB;
  }
 else {
    if (needMemOp) {
      currentBB.addInst(new IRStore(currentBB,rhs.getRegValue(),rhs.getType().getVarSize(),dest,addrOffset));
    }
 else {
      currentBB.addInst(new IRMove(currentBB,(IRRegister)dest,rhs.getRegValue()));
    }
  }
}

Fixed version (ground truth):
private void processIRAssign(RegValue dest,int addrOffset,ExprNode rhs,int size,boolean needMemOp){
  if (rhs.getTrueBB() != null) {
    BasicBlock mergeBB=new BasicBlock(currentFunc,null);
    if (needMemOp) {
      rhs.getTrueBB().addInst(new IRStore(rhs.getTrueBB(),new IntImmediate(1),Configuration.getRegSize(),dest,addrOffset));
      rhs.getFalseBB().addInst(new IRStore(rhs.getFalseBB(),new IntImmediate(0),Configuration.getRegSize(),dest,addrOffset));
    }
 else {
      rhs.getTrueBB().addInst(new IRMove(rhs.getTrueBB(),(VirtualRegister)dest,new IntImmediate(1)));
      rhs.getFalseBB().addInst(new IRMove(rhs.getFalseBB(),(VirtualRegister)dest,new IntImmediate(0)));
    }
    if (!rhs.getTrueBB().isHasJumpInst())     rhs.getTrueBB().setJumpInst(new IRJump(rhs.getTrueBB(),mergeBB));
    if (!rhs.getFalseBB().isHasJumpInst())     rhs.getFalseBB().setJumpInst(new IRJump(rhs.getFalseBB(),mergeBB));
    currentBB=mergeBB;
  }
 else {
    if (needMemOp) {
      currentBB.addInst(new IRStore(currentBB,rhs.getRegValue(),Configuration.getRegSize(),dest,addrOffset));
    }
 else {
      currentBB.addInst(new IRMove(currentBB,(IRRegister)dest,rhs.getRegValue()));
    }
  }
}
Program: 79508
Project: 79508
Buggy source:
private void processSelfIncDec(ExprNode expr,ExprNode node,boolean isSuffix,boolean isInc){
  boolean needMemOp=isMemoryAccess(expr);
  boolean bakWantAddr=wantAddr;
  wantAddr=false;
  expr.accept(this);
  if (isSuffix) {
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRMove(currentBB,vreg,expr.getRegValue()));
    node.setRegValue(vreg);
  }
 else {
    node.setRegValue(expr.getRegValue());
  }
  IntImmediate one=new IntImmediate(1);
  IRBinaryOperation.IRBinaryOp op=isInc ? IRBinaryOperation.IRBinaryOp.ADD : IRBinaryOperation.IRBinaryOp.SUB;
  if (needMemOp) {
    wantAddr=true;
    expr.accept(this);
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRBinaryOperation(currentBB,vreg,op,expr.getRegValue(),one));
    currentBB.addInst(new IRStore(currentBB,vreg,expr.getType().getVarSize(),expr.getAddrValue(),expr.getAddrOffset()));
    if (!isSuffix) {
      expr.setRegValue(vreg);
    }
  }
 else {
    currentBB.addInst(new IRBinaryOperation(currentBB,(IRRegister)expr.getRegValue(),op,expr.getRegValue(),one));
  }
  wantAddr=bakWantAddr;
}

Fixed version (ground truth):
private void processSelfIncDec(ExprNode expr,ExprNode node,boolean isSuffix,boolean isInc){
  boolean needMemOp=isMemoryAccess(expr);
  boolean bakWantAddr=wantAddr;
  wantAddr=false;
  expr.accept(this);
  if (isSuffix) {
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRMove(currentBB,vreg,expr.getRegValue()));
    node.setRegValue(vreg);
  }
 else {
    node.setRegValue(expr.getRegValue());
  }
  IntImmediate one=new IntImmediate(1);
  IRBinaryOperation.IRBinaryOp op=isInc ? IRBinaryOperation.IRBinaryOp.ADD : IRBinaryOperation.IRBinaryOp.SUB;
  if (needMemOp) {
    wantAddr=true;
    expr.accept(this);
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRBinaryOperation(currentBB,vreg,op,expr.getRegValue(),one));
    currentBB.addInst(new IRStore(currentBB,vreg,Configuration.getRegSize(),expr.getAddrValue(),expr.getAddrOffset()));
    if (!isSuffix) {
      expr.setRegValue(vreg);
    }
  }
 else {
    currentBB.addInst(new IRBinaryOperation(currentBB,(IRRegister)expr.getRegValue(),op,expr.getRegValue(),one));
  }
  wantAddr=bakWantAddr;
}
Program: 79509
Project: 79509
Buggy source:
public IRLoad(BasicBlock parentBB,IRRegister dest,int size,StaticData addr,boolean isLoadAddr){
  this(parentBB,dest,size,addr,0);
  this.isStaticData=true;
  this.isLoadAddr=isLoadAddr;
}

Fixed version (ground truth):
public IRLoad(BasicBlock parentBB,IRRegister dest,int size,StaticData addr,boolean isLoadAddr){
  this(parentBB,dest,size,addr,0);
  if (size == 0)   System.err.println("String_Node_Str");
  this.isStaticData=true;
  this.isLoadAddr=isLoadAddr;
}
Program: 79510
Project: 79510
Buggy source:
public IRStore(BasicBlock parentBB,RegValue value,int size,StaticData addr){
  this(parentBB,value,size,addr,0);
  this.isStaticData=true;
}

Fixed version (ground truth):
public IRStore(BasicBlock parentBB,RegValue value,int size,StaticData addr){
  this(parentBB,value,size,addr,0);
  if (size == 0)   System.err.println("String_Node_Str");
  this.isStaticData=true;
}
Program: 79511
Project: 79511
Buggy source:
private void processFuncArgs(IRFunction func){
  Map<IRRegister,IRRegister> argsMap=new HashMap<>();
  IRInstruction firtInst=func.getStartBB().getFirstInst();
  for (int i=0; i < func.getArgVRegList().size(); ++i) {
    VirtualRegister argVreg=func.getArgVRegList().get(i);
    StackSlot argSlot=new StackSlot(func,"String_Node_Str" + i);
    func.getArgsStackSlotMap().put(argVreg,argSlot);
    if (i > 5)     firtInst.prependInst(new IRLoad(firtInst.getParentBB(),argVreg,Configuration.getRegSize(),argSlot,0));
  }
  if (func.getArgVRegList().size() > 0)   func.getArgVRegList().get(0).setForcedPhysicalRegister();
}

Fixed version (ground truth):
private void processFuncArgs(IRFunction func){
  IRInstruction firtInst=func.getStartBB().getFirstInst();
  for (int i=0; i < func.getArgVRegList().size(); ++i) {
    VirtualRegister argVreg=func.getArgVRegList().get(i);
    StackSlot argSlot=new StackSlot(func,"String_Node_Str" + i);
    func.getArgsStackSlotMap().put(argVreg,argSlot);
    if (i > 5)     firtInst.prependInst(new IRLoad(firtInst.getParentBB(),argVreg,Configuration.getRegSize(),argSlot,0));
  }
  if (func.getArgVRegList().size() > 0)   func.getArgVRegList().get(0).setForcedPhysicalRegister(NASMRegisterSet.rdi);
  if (func.getArgVRegList().size() > 1)   func.getArgVRegList().get(1).setForcedPhysicalRegister(NASMRegisterSet.rsi);
  if (func.getArgVRegList().size() > 2)   func.getArgVRegList().get(2).setForcedPhysicalRegister(NASMRegisterSet.rdx);
  if (func.getArgVRegList().size() > 3)   func.getArgVRegList().get(3).setForcedPhysicalRegister(NASMRegisterSet.rcx);
  if (func.getArgVRegList().size() > 4)   func.getArgVRegList().get(4).setForcedPhysicalRegister(NASMRegisterSet.r8);
  if (func.getArgVRegList().size() > 5)   func.getArgVRegList().get(5).setForcedPhysicalRegister(NASMRegisterSet.r9);
}
Program: 79512
Project: 79512
Buggy source:
public void compile() throws Exception {
  System.out.println("String_Node_Str");
  buildAST();
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  IRRoot ir=irBuilder.getIR();
  new TwoRegOpTransformer(ir).run();
  if (Configuration.isEnableFunctionInline()) {
    new FunctionInlineProcessor(ir).run();
  }
  new IRPrinter(outS).visit(ir);
  System.out.println("String_Node_Str");
  new StaticDataProcessor(ir).run();
  new RegLivelinessAnalysis(ir).run();
  new RegisterPreprocessor(ir).run();
  new RegisterAllocator(ir,NASMRegisterSet.generalRegs).run();
}

Fixed version (ground truth):
public void compile() throws Exception {
  System.out.println("String_Node_Str");
  buildAST();
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  IRRoot ir=irBuilder.getIR();
  new TwoRegOpTransformer(ir).run();
  if (Configuration.isEnableFunctionInline()) {
    new FunctionInlineProcessor(ir).run();
  }
  new IRPrinter(outS).visit(ir);
  System.out.println("String_Node_Str");
  new StaticDataProcessor(ir).run();
  new RegLivelinessAnalysis(ir).run();
  new RegisterPreprocessor(ir).run();
}
Program: 79515
Project: 79515
Buggy source:
public FuncEntity(FuncDeclNode node){
  super(node.getName(),new FunctionType(node.getName()));
  parameters=new ArrayList<>();
  for (  VarDeclNode paraDecl : node.getParameterList()) {
    parameters.add(new VarEntity(paraDecl));
  }
  returnType=node.getReturnType().getType();
  isConstruct=node.isConstruct();
}

Fixed version (ground truth):
public FuncEntity(FuncDeclNode node){
  super(node.getName(),new FunctionType(node.getName()));
  parameters=new ArrayList<>();
  for (  VarDeclNode paraDecl : node.getParameterList()) {
    parameters.add(new VarEntity(paraDecl));
  }
  if (node.getReturnType() == null)   returnType=null;
 else   returnType=node.getReturnType().getType();
  isConstruct=node.isConstruct();
}
Program: 79516
Project: 79516
Buggy source:
public ClassEntity(ClassDeclNode node,Scope parentScope){
  super(node.getName(),new ClassType(node.getName()));
  String key;
  Entity entity;
  for (  FuncDeclNode funcMemDecl : node.getFuncMember()) {
    key=Scope.funcKey(funcMemDecl.getName());
    entity=new FuncEntity(funcMemDecl);
    scope.putCheck(funcMemDecl.location(),funcMemDecl.getName(),key,entity);
  }
  scope=new Scope(parentScope);
}

Fixed version (ground truth):
public ClassEntity(ClassDeclNode node,Scope parentScope){
  super(node.getName(),new ClassType(node.getName()));
  String key;
  Entity entity;
  scope=new Scope(parentScope);
  for (  FuncDeclNode funcMemDecl : node.getFuncMember()) {
    key=Scope.funcKey(funcMemDecl.getName());
    entity=new FuncEntity(funcMemDecl);
    scope.putCheck(funcMemDecl.location(),funcMemDecl.getName(),key,entity);
  }
}
Program: 79517
Project: 79517
Buggy source:
public static void main(String[] args) throws Exception {
  String inFile=null, outFile=null;
  boolean isPrintHelp=false, isPrintVersion=false, isPrintConfig=false;
  for (int i=0; i < args.length; ++i) {
    String arg=args[i];
switch (arg) {
case "String_Node_Str":
case "String_Node_Str":
      isPrintHelp=true;
    break;
case "String_Node_Str":
case "String_Node_Str":
  isPrintVersion=true;
break;
case "String_Node_Str":
case "String_Node_Str":
isPrintConfig=true;
break;
case "String_Node_Str":
if (i + 1 < args.length) outFile=args[++i];
 else errorArgs();
break;
default :
if (inFile == null) inFile=arg;
 else errorArgs();
}
}
if (isPrintVersion) printVersion();
if (isPrintHelp) printHelp();
if (isPrintConfig) printConfig();
InputStream inS;
PrintStream outS;
if (inFile == null) inS=System.in;
 else inS=new FileInputStream(inFile);
if (outFile == null) outS=System.out;
 else outS=new PrintStream(new FileOutputStream(outFile));
Compiler compiler=new Compiler(inS,outS);
try {
compiler.compile();
}
 catch (Error e) {
System.err.println(e.getMessage());
System.exit(1);
}
new LLIRInterpreter(new FileInputStream(outFile),false).run();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String inFile=null, outFile=null;
  boolean isPrintHelp=false, isPrintVersion=false, isPrintConfig=false;
  for (int i=0; i < args.length; ++i) {
    String arg=args[i];
switch (arg) {
case "String_Node_Str":
case "String_Node_Str":
      isPrintHelp=true;
    break;
case "String_Node_Str":
case "String_Node_Str":
  isPrintVersion=true;
break;
case "String_Node_Str":
case "String_Node_Str":
isPrintConfig=true;
break;
case "String_Node_Str":
if (i + 1 < args.length) outFile=args[++i];
 else errorArgs();
break;
default :
if (inFile == null) inFile=arg;
 else errorArgs();
}
}
if (isPrintVersion) printVersion();
if (isPrintHelp) printHelp();
if (isPrintConfig) printConfig();
InputStream inS;
PrintStream outS;
if (inFile == null) inS=System.in;
 else inS=new FileInputStream(inFile);
if (outFile == null) outS=System.out;
 else outS=new PrintStream(new FileOutputStream(outFile));
Compiler compiler=new Compiler(inS,outS);
try {
compiler.compile();
}
 catch (Error e) {
System.err.println(e.getMessage());
System.exit(1);
}
LLIRInterpreter leLeIRInterpreter=new LLIRInterpreter(new FileInputStream(outFile),false);
leLeIRInterpreter.run();
System.out.println("String_Node_Str" + leLeIRInterpreter.getExitcode());
}
Program: 79518
Project: 79518
Buggy source:
private void processSelfIncDec(ExprNode expr,ExprNode node,boolean isSuffix,boolean isInc){
  boolean needMemOp=isMemoryAccess(expr);
  boolean bakWantAddr=wantAddr;
  wantAddr=false;
  expr.accept(this);
  if (isSuffix) {
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRMove(currentBB,vreg,expr.getRegValue()));
    node.setRegValue(vreg);
  }
 else {
    node.setRegValue(expr.getRegValue());
  }
  IntImmediate one=new IntImmediate(1);
  IRBinaryOperation.IRBinaryOp op=isInc ? IRBinaryOperation.IRBinaryOp.ADD : IRBinaryOperation.IRBinaryOp.SUB;
  if (needMemOp) {
    wantAddr=true;
    expr.accept(this);
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRBinaryOperation(currentBB,vreg,op,expr.getRegValue(),one));
    currentBB.addInst(new IRStore(currentBB,vreg,expr.getType().getVarSize(),expr.getAddrValue(),expr.getAddrOffset()));
    if (!isSuffix) {
      expr.setRegValue(vreg);
    }
  }
 else {
    currentBB.addInst(new IRBinaryOperation(currentBB,(IRRegister)expr.getRegValue(),op,expr.getAddrValue(),one));
  }
  wantAddr=bakWantAddr;
}

Fixed version (ground truth):
private void processSelfIncDec(ExprNode expr,ExprNode node,boolean isSuffix,boolean isInc){
  boolean needMemOp=isMemoryAccess(expr);
  boolean bakWantAddr=wantAddr;
  wantAddr=false;
  expr.accept(this);
  if (isSuffix) {
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRMove(currentBB,vreg,expr.getRegValue()));
    node.setRegValue(vreg);
  }
 else {
    node.setRegValue(expr.getRegValue());
  }
  IntImmediate one=new IntImmediate(1);
  IRBinaryOperation.IRBinaryOp op=isInc ? IRBinaryOperation.IRBinaryOp.ADD : IRBinaryOperation.IRBinaryOp.SUB;
  if (needMemOp) {
    wantAddr=true;
    expr.accept(this);
    VirtualRegister vreg=new VirtualRegister(null);
    currentBB.addInst(new IRBinaryOperation(currentBB,vreg,op,expr.getRegValue(),one));
    currentBB.addInst(new IRStore(currentBB,vreg,expr.getType().getVarSize(),expr.getAddrValue(),expr.getAddrOffset()));
    if (!isSuffix) {
      expr.setRegValue(vreg);
    }
  }
 else {
    currentBB.addInst(new IRBinaryOperation(currentBB,(IRRegister)expr.getRegValue(),op,expr.getRegValue(),one));
  }
  wantAddr=bakWantAddr;
}
Program: 79519
Project: 79519
Buggy source:
public void compile() throws Exception {
  System.out.println("String_Node_Str");
  buildAST();
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(globalScopePreScanner.getScope());
  functionScopeScanner.visit(ast);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void compile() throws Exception {
  System.out.println("String_Node_Str");
  buildAST();
  ASTPrinter astPrinter=new ASTPrinter(outS);
  astPrinter.visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(globalScopePreScanner.getScope());
  functionScopeScanner.visit(ast);
  System.out.println("String_Node_Str");
}
Program: 79520
Project: 79520
Buggy source:
public ClassEntity(ClassDeclNode node,Scope parentScope){
  super(node.getName(),new ClassType(node.getName()));
  String key;
  FuncEntity entity;
  for (  FuncDeclNode funcMemDecl : node.getFuncMember()) {
    key=Scope.funcKey(funcMemDecl.getName());
    entity=new FuncEntity(funcMemDecl);
    if (!scope.put(key,entity))     throw new SemanticError(funcMemDecl.location(),String.format("String_Node_Str",funcMemDecl.getName()));
  }
  scope=new Scope(parentScope);
}

Fixed version (ground truth):
public ClassEntity(ClassDeclNode node,Scope parentScope){
  super(node.getName(),new ClassType(node.getName()));
  String key;
  Entity entity;
  for (  FuncDeclNode funcMemDecl : node.getFuncMember()) {
    key=Scope.funcKey(funcMemDecl.getName());
    entity=new FuncEntity(funcMemDecl);
    scope.putCheck(funcMemDecl.location(),funcMemDecl.getName(),key,entity);
  }
  scope=new Scope(parentScope);
}
Program: 79521
Project: 79521
Buggy source:
private boolean selfContainsExactKey(String key){
  return entityMap.containsKey(key);
}

Fixed version (ground truth):
public boolean selfContainsExactKey(String key){
  return entityMap.containsKey(key);
}
Program: 79522
Project: 79522
Buggy source:
public IRPrinter(PrintStream out){
  this.out=out;
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public IRPrinter(PrintStream out){
  this.out=out;
}
Program: 79523
Project: 79523
Buggy source:
private void dfsPostOrder(BasicBlock bb){
  System.out.println("String_Node_Str" + bb.getName());
  if (dfsVisited.contains(bb))   return;
  for (  BasicBlock nextBB : bb.getNextBBSet()) {
    dfsPostOrder(nextBB);
  }
  reversePostOrder.add(bb);
}

Fixed version (ground truth):
private void dfsPostOrder(BasicBlock bb){
  if (dfsVisited.contains(bb))   return;
  dfsVisited.add(bb);
  for (  BasicBlock nextBB : bb.getNextBBSet()) {
    dfsPostOrder(nextBB);
  }
  reversePostOrder.add(bb);
}
Program: 79524
Project: 79524
Buggy source:
public List<BasicBlock> getReversePostOrder(){
  System.out.println("String_Node_Str");
  if (reversePostOrder != null)   return reversePostOrder;
  reversePostOrder=new ArrayList<>();
  dfsVisited=new HashSet<>();
  dfsPostOrder(startBB);
  System.out.println("String_Node_Str");
  dfsVisited=null;
  for (int i=0; i < reversePostOrder.size(); ++i) {
    reversePostOrder.get(i).setPostOrderIdx(i);
  }
  Collections.reverse(reversePostOrder);
  return reversePostOrder;
}

Fixed version (ground truth):
public List<BasicBlock> getReversePostOrder(){
  if (reversePostOrder != null)   return reversePostOrder;
  reversePostOrder=new ArrayList<>();
  dfsVisited=new HashSet<>();
  dfsPostOrder(startBB);
  dfsVisited=null;
  for (int i=0; i < reversePostOrder.size(); ++i) {
    reversePostOrder.get(i).setPostOrderIdx(i);
  }
  Collections.reverse(reversePostOrder);
  return reversePostOrder;
}
Program: 79525
Project: 79525
Buggy source:
private void processIRAssign(RegValue dest,int addrOffset,ExprNode rhs,int size,boolean needMemOp){
  if (rhs.getType() instanceof BoolType) {
    BasicBlock mergeBB=new BasicBlock(currentFunc,null);
    if (needMemOp) {
      rhs.getTrueBB().addInst(new IRStore(rhs.getTrueBB(),new IntImmediate(1),BoolType.getInstance().getVarSize(),dest,addrOffset));
      rhs.getFalseBB().addInst(new IRStore(rhs.getFalseBB(),new IntImmediate(0),BoolType.getInstance().getVarSize(),dest,addrOffset));
    }
 else {
      rhs.getTrueBB().addInst(new IRMove(rhs.getTrueBB(),(VirtualRegister)dest,new IntImmediate(1)));
      rhs.getFalseBB().addInst(new IRMove(rhs.getFalseBB(),(VirtualRegister)dest,new IntImmediate(0)));
    }
    rhs.getTrueBB().addInst(new IRJump(rhs.getTrueBB(),mergeBB));
    rhs.getFalseBB().addInst(new IRJump(rhs.getFalseBB(),mergeBB));
  }
 else {
    if (needMemOp) {
      currentBB.addInst(new IRStore(currentBB,rhs.getRegValue(),rhs.getType().getVarSize(),dest,addrOffset));
    }
 else {
      currentBB.addInst(new IRMove(currentBB,(IRRegister)dest,rhs.getRegValue()));
    }
  }
}

Fixed version (ground truth):
private void processIRAssign(RegValue dest,int addrOffset,ExprNode rhs,int size,boolean needMemOp){
  if (rhs.getType() instanceof BoolType) {
    BasicBlock mergeBB=new BasicBlock(currentFunc,null);
    if (needMemOp) {
      rhs.getTrueBB().addInst(new IRStore(rhs.getTrueBB(),new IntImmediate(1),BoolType.getInstance().getVarSize(),dest,addrOffset));
      rhs.getFalseBB().addInst(new IRStore(rhs.getFalseBB(),new IntImmediate(0),BoolType.getInstance().getVarSize(),dest,addrOffset));
    }
 else {
      rhs.getTrueBB().addInst(new IRMove(rhs.getTrueBB(),(VirtualRegister)dest,new IntImmediate(1)));
      rhs.getFalseBB().addInst(new IRMove(rhs.getFalseBB(),(VirtualRegister)dest,new IntImmediate(0)));
    }
    rhs.getTrueBB().setJumpInst(new IRJump(rhs.getTrueBB(),mergeBB));
    rhs.getFalseBB().setJumpInst(new IRJump(rhs.getFalseBB(),mergeBB));
    currentBB=mergeBB;
  }
 else {
    if (needMemOp) {
      currentBB.addInst(new IRStore(currentBB,rhs.getRegValue(),rhs.getType().getVarSize(),dest,addrOffset));
    }
 else {
      currentBB.addInst(new IRMove(currentBB,(IRRegister)dest,rhs.getRegValue()));
    }
  }
}
Program: 79526
Project: 79526
Buggy source:
private void processLogicalBinaryOp(BinaryExprNode node){
  if (node.getOp() == BinaryExprNode.BinaryOps.LOGIC_AND) {
    node.getLhs().setTrueBB(new BasicBlock(currentFunc,"String_Node_Str"));
    node.getLhs().setFalseBB(node.getFalseBB());
    node.getLhs().accept(this);
    currentBB=node.getLhs().getTrueBB();
  }
 else   if (node.getOp() == BinaryExprNode.BinaryOps.LOGIC_OR) {
    node.getLhs().setTrueBB(node.getTrueBB());
    node.getRhs().setFalseBB(new BasicBlock(currentFunc,"String_Node_Str"));
    node.getLhs().accept(this);
    currentBB=node.getLhs().getFalseBB();
  }
 else {
    throw new CompilerError("String_Node_Str");
  }
  node.getRhs().setTrueBB(node.getTrueBB());
  node.getRhs().setFalseBB(node.getFalseBB());
  node.getRhs().accept(this);
}

Fixed version (ground truth):
private void processLogicalBinaryOp(BinaryExprNode node){
  if (node.getOp() == BinaryExprNode.BinaryOps.LOGIC_AND) {
    node.getLhs().setTrueBB(new BasicBlock(currentFunc,"String_Node_Str"));
    node.getLhs().setFalseBB(node.getFalseBB());
    node.getLhs().accept(this);
    currentBB=node.getLhs().getTrueBB();
  }
 else   if (node.getOp() == BinaryExprNode.BinaryOps.LOGIC_OR) {
    node.getLhs().setTrueBB(node.getTrueBB());
    node.getLhs().setFalseBB(new BasicBlock(currentFunc,"String_Node_Str"));
    node.getLhs().accept(this);
    currentBB=node.getLhs().getFalseBB();
  }
 else {
    throw new CompilerError("String_Node_Str");
  }
  node.getRhs().setTrueBB(node.getTrueBB());
  node.getRhs().setFalseBB(node.getFalseBB());
  node.getRhs().accept(this);
}
Program: 79527
Project: 79527
Buggy source:
public void addNextBB(BasicBlock bb){
  if (bb != null) {
    nextBBSet.add(bb);
  }
  bb.addPrevBB(this);
}

Fixed version (ground truth):
public void addNextBB(BasicBlock bb){
  nextBBSet.add(bb);
  if (bb != null) {
    bb.addPrevBB(this);
  }
}
Program: 79528
Project: 79528
Buggy source:
public void compile() throws Exception {
  System.out.println("String_Node_Str");
  buildAST();
  ASTPrinter astPrinter=new ASTPrinter(outS);
  astPrinter.visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public void compile() throws Exception {
  System.out.println("String_Node_Str");
  buildAST();
  ASTPrinter astPrinter=new ASTPrinter(outS);
  astPrinter.visit(ast);
  GlobalScopePreScanner globalScopePreScanner=new GlobalScopePreScanner();
  globalScopePreScanner.visit(ast);
  ClassVarMemberScanner classVarMemberScanner=new ClassVarMemberScanner(globalScopePreScanner.getScope());
  classVarMemberScanner.visit(ast);
  FunctionScopeScanner functionScopeScanner=new FunctionScopeScanner(classVarMemberScanner.getGlobalScope());
  functionScopeScanner.visit(ast);
  IRBuilder irBuilder=new IRBuilder(functionScopeScanner.getGlobalScope());
  irBuilder.visit(ast);
  System.out.println("String_Node_Str");
}
Program: 79529
Project: 79529
Buggy source:
@Override public Node visitAssignExpr(EMxStarParser.AssignExprContext ctx){
  ExprNode lhs=(ExprNode)visit(ctx.lhs);
  ExprNode rhs=(ExprNode)visit(ctx.rhs);
  if (rhs instanceof NewExprNode && ((NewExprNode)rhs).getDims() != null && ((NewExprNode)rhs).getDims().size() > 1) {
    Location loc=Location.fromCtx(ctx);
    Type newTypeNow=((NewExprNode)rhs).getNewType().getType();
    return expandMultiArray(lhs,rhs,0,newTypeNow,loc);
  }
  return new AssignExprNode(lhs,rhs,Location.fromCtx(ctx));
}

Fixed version (ground truth):
@Override public Node visitAssignExpr(EMxStarParser.AssignExprContext ctx){
  ExprNode lhs=(ExprNode)visit(ctx.lhs);
  ExprNode rhs=(ExprNode)visit(ctx.rhs);
  return new AssignExprNode(lhs,rhs,Location.fromCtx(ctx));
}
Program: 79530
Project: 79530
Buggy source:
private FuncDeclNode makeInitFunc(){
  List<Node> stmts=new ArrayList<>();
  for (  GlobalVarInit init : globalInitList) {
    IdentifierExprNode lhs=new IdentifierExprNode(init.getName(),null);
    AssignExprNode assignExpr=new AssignExprNode(lhs,init.getInitExpr(),null);
    stmts.add(new ExprStmtNode(assignExpr,null));
  }
  BlockStmtNode body=new BlockStmtNode(stmts,null);
  TypeNode retType=new TypeNode(VoidType.getInstance(),null);
  FuncDeclNode funcNode=new FuncDeclNode(retType,INIT_FUNC_NAME,new ArrayList<>(),body,null);
  globalScope.put(Scope.funcKey(INIT_FUNC_NAME),new FuncEntity(funcNode));
  return funcNode;
}

Fixed version (ground truth):
private FuncDeclNode makeInitFunc(){
  List<Node> stmts=new ArrayList<>();
  for (  GlobalVarInit init : globalInitList) {
    IdentifierExprNode lhs=new IdentifierExprNode(init.getName(),null);
    AssignExprNode assignExpr=new AssignExprNode(lhs,init.getInitExpr(),null);
    stmts.add(new ExprStmtNode(assignExpr,null));
  }
  BlockStmtNode body=new BlockStmtNode(stmts,null);
  body.initScope(globalScope);
  TypeNode retType=new TypeNode(VoidType.getInstance(),null);
  FuncDeclNode funcNode=new FuncDeclNode(retType,INIT_FUNC_NAME,new ArrayList<>(),body,null);
  FuncEntity funcEntity=new FuncEntity(funcNode);
  globalScope.put(Scope.funcKey(INIT_FUNC_NAME),funcEntity);
  IRFunction newIRFunc=new IRFunction(funcEntity);
  ir.addFunc(newIRFunc);
  return funcNode;
}
Program: 79531
Project: 79531
Buggy source:
private boolean isMemoryAccess(ExprNode node){
  return node instanceof SubscriptExprNode || node instanceof MemberAccessExprNode;
}

Fixed version (ground truth):
private boolean isMemoryAccess(ExprNode node){
  return node instanceof SubscriptExprNode || node instanceof MemberAccessExprNode || (node instanceof IdentifierExprNode && checkIdentiferThisMemberAccess((IdentifierExprNode)node));
}
Program: 79532
Project: 79532
Buggy source:
public static void main(String[] args) throws Exception {
  String inFile=null, outFile=null;
  boolean isPrintHelp=false, isPrintVersion=false, isPrintConfig=false;
  for (int i=0; i < args.length; ++i) {
    String arg=args[i];
switch (arg) {
case "String_Node_Str":
case "String_Node_Str":
      isPrintHelp=true;
    break;
case "String_Node_Str":
case "String_Node_Str":
  isPrintVersion=true;
break;
case "String_Node_Str":
case "String_Node_Str":
isPrintConfig=true;
break;
case "String_Node_Str":
if (i + 1 < args.length) outFile=args[++i];
 else errorArgs();
break;
default :
if (inFile == null) inFile=arg;
 else errorArgs();
}
}
if (isPrintVersion) printVersion();
if (isPrintHelp) printHelp();
if (isPrintConfig) printConfig();
InputStream inS;
PrintStream outS;
if (inFile == null) inS=System.in;
 else inS=new FileInputStream(inFile);
if (outFile == null) outS=System.out;
 else outS=new PrintStream(new FileOutputStream(outFile));
Compiler compiler=new Compiler(inS,outS);
try {
compiler.run();
}
 catch (Error e) {
System.err.println(e.getMessage());
System.exit(1);
}
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String inFile=null, outFile=null;
  boolean isPrintHelp=false, isPrintVersion=false, isPrintConfig=false;
  for (int i=0; i < args.length; ++i) {
    String arg=args[i];
switch (arg) {
case "String_Node_Str":
case "String_Node_Str":
      isPrintHelp=true;
    break;
case "String_Node_Str":
case "String_Node_Str":
  isPrintVersion=true;
break;
case "String_Node_Str":
case "String_Node_Str":
isPrintConfig=true;
break;
case "String_Node_Str":
if (i + 1 < args.length) outFile=args[++i];
 else errorArgs();
break;
default :
if (inFile == null) inFile=arg;
 else errorArgs();
}
}
if (isPrintVersion) printVersion();
if (isPrintHelp) printHelp();
if (isPrintConfig) printConfig();
InputStream inS;
PrintStream outS;
if (inFile == null) inS=System.in;
 else inS=new FileInputStream(inFile);
if (outFile == null) outS=System.out;
 else outS=new PrintStream(new FileOutputStream(outFile));
Compiler compiler=new Compiler(inS,outS);
try {
compiler.compile();
}
 catch (Error e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Program: 79533
Project: 79533
Buggy source:
@Override public Node visitNonArrayTypeType(EMxStarParser.NonArrayTypeTypeContext ctx){
  if (ctx.Identifier() != null)   return new TypeNode(new ClassType(ctx.Identifier().getText()),Location.fromCtx(ctx));
  Type type;
  if (ctx.Int() != null)   type=IntType.getInstance();
 else   if (ctx.Bool() != null)   type=BoolType.getInstance();
 else   if (ctx.String() != null)   type=VoidType.getInstance();
 else   if (ctx.Identifier() != null)   type=new ClassType(ctx.Identifier().getText());
 else   throw new CompilerError(Location.fromCtx(ctx),"String_Node_Str");
  return new TypeNode(type,Location.fromCtx(ctx));
}

Fixed version (ground truth):
@Override public Node visitNonArrayTypeType(EMxStarParser.NonArrayTypeTypeContext ctx){
  if (ctx.Identifier() != null)   return new TypeNode(new ClassType(ctx.Identifier().getText()),Location.fromCtx(ctx));
  Type type;
  if (ctx.Int() != null)   type=IntType.getInstance();
 else   if (ctx.Bool() != null)   type=BoolType.getInstance();
 else   if (ctx.String() != null)   type=StringType.getInstance();
 else   if (ctx.Identifier() != null)   type=new ClassType(ctx.Identifier().getText());
 else   throw new CompilerError(Location.fromCtx(ctx),"String_Node_Str");
  return new TypeNode(type,Location.fromCtx(ctx));
}
Program: 79534
Project: 79534
Buggy source:
@Override public Node visitBlock(EMxStarParser.BlockContext ctx){
  List<Node> stmtsAndVarDecls=new ArrayList<>();
  if (ctx.blockStatement() != null) {
    for (    ParserRuleContext blockStatement : ctx.blockStatement()) {
      Node node=visit(blockStatement);
      if (node != null)       stmtsAndVarDecls.add(node);
    }
  }
  return new BlockStmtNode(stmtsAndVarDecls,Location.fromCtx(ctx));
}

Fixed version (ground truth):
@Override public Node visitBlock(EMxStarParser.BlockContext ctx){
  List<Node> stmtsAndVarDecls=new ArrayList<>();
  if (ctx.blockStatement() != null) {
    for (    ParserRuleContext blockStatement : ctx.blockStatement()) {
      Node node=visit(blockStatement);
      if (node != null) {
        if (node instanceof VarDeclListNode)         stmtsAndVarDecls.addAll(((VarDeclListNode)node).getDecls());
 else         stmtsAndVarDecls.add(node);
      }
    }
  }
  return new BlockStmtNode(stmtsAndVarDecls,Location.fromCtx(ctx));
}
Program: 79535
Project: 79535
Buggy source:
@Override public void onStockFetched(Stock stock){
  if (swipeRefreshLayout != null)   swipeRefreshLayout.setRefreshing(false);
  if (stock != null) {
    stockTrackingBinding.setStock(stock);
    currentStock=stock;
    Timber.d("String_Node_Str");
  }
 else {
    Timber.d("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onStockFetched(Stock stock){
  if (swipeRefreshLayout != null)   swipeRefreshLayout.setRefreshing(false);
  if (stock != null) {
    stockTrackingBinding.setStock(stock);
    currentStock=stock;
  }
}
Program: 79536
Project: 79536
Buggy source:
@Override public void unsubscribe(){
  compositeSubscription.clear();
}

Fixed version (ground truth):
@Override public void unsubscribe(){
  Timber.d("String_Node_Str");
  compositeSubscription.clear();
}
Program: 79537
Project: 79537
Buggy source:
public void fetchstock(String stockName,boolean inBackground){
  if (!inBackground)   stockView.showLoading();
  compositeSubscription.add(stockDataRepository.getStock(stockName).subscribeOn(AndroidSchedulers.mainThread()).subscribe(stock -> {
    stockView.onStockFetched(stock);
  }
,throwable -> {
    throwable.printStackTrace();
  }
));
}

Fixed version (ground truth):
public void fetchstock(String stockName,boolean inBackground){
  if (fetchSubsciption != null) {
    compositeSubscription.remove(fetchSubsciption);
  }
  if (!inBackground)   stockView.showLoading();
  fetchSubsciption=stockDataRepository.getStock(stockName).observeOn(AndroidSchedulers.mainThread(),true).subscribe(stock -> {
    stockView.onStockFetched(stock);
  }
,e -> {
    if (e instanceof IOException && !NetworkUtils.isInternetOn(StockTrackerApp.getContext())) {
      stockView.showError(StringUtils.getString(R.string.no_internet));
    }
 else     stockView.showError(StringUtils.getString(R.string.something_went_wrong));
  }
);
  compositeSubscription.add(fetchSubsciption);
}
Program: 79538
Project: 79538
Buggy source:
@Override public Observable<Stock> getStock(String stockName){
  return RetrofitService.getInstance().getStockData(RestApi.FUNCTION.TIME_SERIES_DAILY,stockName,RestApi.INTERVAL.MIN_15.getValue(),RestApi.OUTPUT_SIZE.COMPACT,API_KEY).map(stockApiResponse -> getStockFromStockApiResponse(stockApiResponse));
}

Fixed version (ground truth):
@Override public Observable<Stock> getStock(String stockName){
  return RetrofitService.getInstance().getStockData(RestApi.FUNCTION.TIME_SERIES_DAILY,stockName,RestApi.INTERVAL.MIN_15.getValue(),RestApi.OUTPUT_SIZE.COMPACT,API_KEY).map(stockApiResponse -> getStockFromStockApiResponse(stockApiResponse)).subscribeOn(Schedulers.io());
}
Program: 79539
Project: 79539
Buggy source:
@Override protected void onPause(){
  super.onPause();
  scheduleStockSyncService(this,60 * 60,60 * 60 * 2);
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  FirebaseHelper.scheduleStockSyncService(this,60 * 60,60 * 60 * 2);
}
Program: 79540
Project: 79540
Buggy source:
private void removeFocusAndCloseKeyboard(){
  stockEditText.requestFocus();
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(stockEditText.getRootView().getWindowToken(),0);
}

Fixed version (ground truth):
private void removeFocusAndCloseKeyboard(){
  stockEditText.requestFocus();
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(stockEditText.getWindowToken(),0);
}
Program: 79541
Project: 79541
Buggy source:
private void focusEditTextAndOpenKeyboard(){
  getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  stockEditText.requestFocus();
  stockEditText.performClick();
}

Fixed version (ground truth):
private void focusEditTextAndOpenKeyboard(){
  getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
Program: 79542
Project: 79542
Buggy source:
@Override public void setupDialog(Dialog dialog,int style){
  super.setupDialog(dialog,style);
  mView=View.inflate(getContext(),R.layout.fragment_stock_selector,null);
  dialog.setContentView(mView);
  ButterKnife.bind(this,mView);
  focusEditTextAndOpenKeyboard();
  stockEditText.setOnFocusChangeListener(new MyFocusChangeListener());
  CoordinatorLayout.LayoutParams params=(CoordinatorLayout.LayoutParams)((View)mView.getParent()).getLayoutParams();
  CoordinatorLayout.Behavior behavior=params.getBehavior();
  if (behavior != null && behavior instanceof BottomSheetBehavior) {
    ((BottomSheetBehavior)behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
  }
  ButterKnife.bind(this,mView);
}

Fixed version (ground truth):
@Override public void setupDialog(Dialog dialog,int style){
  super.setupDialog(dialog,style);
  mView=View.inflate(getContext(),R.layout.fragment_stock_selector,null);
  dialog.setContentView(mView);
  ButterKnife.bind(this,mView);
  focusEditTextAndOpenKeyboard();
  CoordinatorLayout.LayoutParams params=(CoordinatorLayout.LayoutParams)((View)mView.getParent()).getLayoutParams();
  CoordinatorLayout.Behavior behavior=params.getBehavior();
  if (behavior != null && behavior instanceof BottomSheetBehavior) {
    ((BottomSheetBehavior)behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
  }
  ButterKnife.bind(this,mView);
}