Program: 29368
Project: 29368
Buggy source:
/** 
 * Enters a new scope. Variables may only be defined within a scope. 
 */
Scope enterScope(){
  final Map<VarKey,Variable> currentFrame=new LinkedHashMap<>();
  final Label scopeExit=new Label();
  frames.push(currentFrame);
  return new Scope(){
    @Override Variable createSynthetic(    SyntheticVarName varName,    Expression initExpr,    SaveStrategy strategy){
      VarKey key=VarKey.create(Kind.SYNTHETIC,varName.name());
      String name=fieldNames.generateName("String_Node_Str" + varName.name());
      return doCreate(name,new Label(),scopeExit,initExpr,key,strategy);
    }
    @Override Variable createTemporary(    String name,    Expression initExpr){
      VarKey key=VarKey.create(Kind.TEMPORARY,name);
      name=fieldNames.generateName("String_Node_Str" + name);
      return doCreate(name,new Label(),scopeExit,initExpr,key,SaveStrategy.NEVER);
    }
    @Override Variable create(    String name,    Expression initExpr,    SaveStrategy strategy){
      VarKey key=VarKey.create(Kind.USER_DEFINED,name);
      name=fieldNames.generateName(name);
      return doCreate(name,new Label(),scopeExit,initExpr,key,strategy);
    }
    @Override Statement exitScope(){
      frames.pop();
      final Set<Label> endLabels=Sets.newIdentityHashSet();
      for (      Variable var : currentFrame.values()) {
        endLabels.add(var.local.end());
        availableSlots.clear(var.local.index(),var.local.index() + var.local.resultType().getSize());
      }
      return new Statement(){
        @Override void doGen(        CodeBuilder adapter){
          for (          Label label : endLabels) {
            adapter.visitLabel(label);
          }
        }
      }
;
    }
    private Variable doCreate(    String name,    Label start,    Label end,    Expression initExpr,    VarKey key,    SaveStrategy strategy){
      int index=reserveSlotFor(initExpr.resultType());
      LocalVariable local=LocalVariable.createLocal(name,index,initExpr.resultType(),start,end);
      Variable var;
switch (strategy) {
case DERIVED:
        var=new DerivedVariable(initExpr,local);
      break;
case NEVER:
    var=new TemporaryVariable(initExpr,local);
  break;
case STORE:
var=new FieldSavedVariable(initExpr,local);
break;
default :
throw new AssertionError();
}
currentFrame.put(key,var);
allVariables.add(var);
return var;
}
}
;
}

Fixed version (ground truth):
/** 
 * Enters a new scope. Variables may only be defined within a scope. 
 */
Scope enterScope(){
  final Map<VarKey,Variable> currentFrame=new LinkedHashMap<>();
  final Label scopeExit=new Label();
  frames.push(currentFrame);
  return new Scope(){
    boolean exited;
    @Override Variable createSynthetic(    SyntheticVarName varName,    Expression initExpr,    SaveStrategy strategy){
      checkState(!exited,"String_Node_Str");
      VarKey key=VarKey.create(Kind.SYNTHETIC,varName.name());
      String name=fieldNames.generateName("String_Node_Str" + varName.name());
      return doCreate(name,new Label(),scopeExit,initExpr,key,strategy);
    }
    @Override Variable createTemporary(    String name,    Expression initExpr){
      checkState(!exited,"String_Node_Str");
      VarKey key=VarKey.create(Kind.TEMPORARY,name);
      name=fieldNames.generateName("String_Node_Str" + name);
      return doCreate(name,new Label(),scopeExit,initExpr,key,SaveStrategy.NEVER);
    }
    @Override Variable create(    String name,    Expression initExpr,    SaveStrategy strategy){
      checkState(!exited,"String_Node_Str");
      VarKey key=VarKey.create(Kind.USER_DEFINED,name);
      name=fieldNames.generateName(name);
      return doCreate(name,new Label(),scopeExit,initExpr,key,strategy);
    }
    @Override Statement exitScope(){
      checkState(!exited,"String_Node_Str");
      exited=true;
      frames.pop();
      final Set<Label> endLabels=Sets.newIdentityHashSet();
      for (      Variable var : currentFrame.values()) {
        endLabels.add(var.local.end());
        availableSlots.clear(var.local.index(),var.local.index() + var.local.resultType().getSize());
      }
      return new Statement(){
        @Override void doGen(        CodeBuilder adapter){
          for (          Label label : endLabels) {
            adapter.visitLabel(label);
          }
        }
      }
;
    }
    private Variable doCreate(    String name,    Label start,    Label end,    Expression initExpr,    VarKey key,    SaveStrategy strategy){
      int index=reserveSlotFor(initExpr.resultType());
      LocalVariable local=LocalVariable.createLocal(name,index,initExpr.resultType(),start,end);
      Variable var;
switch (strategy) {
case DERIVED:
        var=new DerivedVariable(initExpr,local);
      break;
case NEVER:
    var=new TemporaryVariable(initExpr,local);
  break;
case STORE:
var=new FieldSavedVariable(initExpr,local);
break;
default :
throw new AssertionError();
}
currentFrame.put(key,var);
allVariables.add(var);
return var;
}
}
;
}