Program: 78275
Project: 78275
Buggy source:
private Operand visitCreateArray(NewExprNode node,int index){
  Var baseReg=Var.tmpBuilder("String_Node_Str");
  Operand size=visit(node.getDimArgs().get(index));
  Operand bitSize=visitArithComp(visitArithComp(size,MUL,PTR_SIZE,INT_TYPE_SYMBOL),ADD,LENGTH_SIZE,INT_TYPE_SYMBOL);
  currentBasicBlock.pushBack(new FunctionCallInst(Function.MALLOC,new ArrayList<>(Collections.singletonList(bitSize)),baseReg));
  currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,null,0,0),size));
  boolean terminal=index == node.getDimArgs().size() - 1;
  boolean createClass=!node.getCreateType().isPrimitiveTypeBase() && node.getEmptyDim() == 0;
  if (!terminal || createClass) {
    Var indexReg=Var.tmpBuilder("String_Node_Str");
    currentBasicBlock.pushBack(new MoveInst(indexReg,ZERO_LITERAL));
    newValTag();
    BasicBlock creatorLoopBegin=new BasicBlock(currentBasicBlock.parentFunction(),SymbolTable.builder(currentSymbolTable),"String_Node_Str",valTag);
    popValTag();
    BasicBlock next=new BasicBlock(currentBasicBlock.parentFunction(),currentSymbolTable,"String_Node_Str",valTag);
    currentBasicBlock.pushBack(new DirectJumpInst(creatorLoopBegin));
    setCurrentEnv(creatorLoopBegin);
    Operand created;
    if (!terminal)     created=visitCreateArray(node,index + 1);
 else     created=visitCreateClass(node.getCreateType().getBaseType());
    currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,indexReg,options.PTR_SIZE,options.LENGTH_SIZE),created));
    Operand indexTmp=visitArithComp(indexReg,ADD,ONE_LITERAL,INT_TYPE_SYMBOL);
    resetCurrentBasicBlockBackDst(indexReg,indexTmp,INT_TYPE_SYMBOL);
    Operand ltTmp=visitArithComp(indexReg,LT,size,INT_TYPE_SYMBOL);
    currentBasicBlock.pushBack(new CondJumpInst(ltTmp,creatorLoopBegin,next));
    popValTag();
    setCurrentEnv(next);
  }
  return baseReg;
}

Fixed version (ground truth):
private Operand visitCreateArray(NewExprNode node,int index){
  Var baseReg=Var.tmpBuilder("String_Node_Str");
  Operand size=visit(node.getDimArgs().get(index));
  Operand bitSize=visitArithComp(visitArithComp(size,MUL,PTR_SIZE,INT_TYPE_SYMBOL),ADD,LENGTH_SIZE,INT_TYPE_SYMBOL);
  currentBasicBlock.pushBack(new FunctionCallInst(Function.MALLOC,new ArrayList<>(Collections.singletonList(bitSize)),baseReg));
  currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,null,0,0),size));
  boolean terminal=index == node.getDimArgs().size() - 1;
  if (!terminal) {
    Var indexReg=Var.tmpBuilder("String_Node_Str");
    currentBasicBlock.pushBack(new MoveInst(indexReg,ZERO_LITERAL));
    newValTag();
    BasicBlock creatorLoopBegin=new BasicBlock(currentBasicBlock.parentFunction(),SymbolTable.builder(currentSymbolTable),"String_Node_Str",valTag);
    popValTag();
    BasicBlock next=new BasicBlock(currentBasicBlock.parentFunction(),currentSymbolTable,"String_Node_Str",valTag);
    currentBasicBlock.pushBack(new DirectJumpInst(creatorLoopBegin));
    setCurrentEnv(creatorLoopBegin);
    Operand created;
    if (!terminal)     created=visitCreateArray(node,index + 1);
 else     created=visitCreateClass(node.getCreateType().getBaseType());
    currentBasicBlock.pushBack(new MoveInst(new Memory(baseReg,indexReg,options.PTR_SIZE,options.LENGTH_SIZE),created));
    Operand indexTmp=visitArithComp(indexReg,ADD,ONE_LITERAL,INT_TYPE_SYMBOL);
    resetCurrentBasicBlockBackDst(indexReg,indexTmp,INT_TYPE_SYMBOL);
    Operand ltTmp=visitArithComp(indexReg,LT,size,INT_TYPE_SYMBOL);
    currentBasicBlock.pushBack(new CondJumpInst(ltTmp,creatorLoopBegin,next));
    popValTag();
    setCurrentEnv(next);
  }
  return baseReg;
}