Program: 84438
Project: 84438
Buggy source:
private void generateSwitch(MethodWriter writer,boolean expr,Object frameType) throws BytecodeException {
  Label defaultLabel=null;
  int cases=0;
  int low=Integer.MAX_VALUE;
  int high=Integer.MIN_VALUE;
  boolean switchVar=false;
  for (int i=0; i < this.caseCount; i++) {
    MatchCase matchCase=this.cases[i];
    IPattern pattern=matchCase.pattern;
    Label label=matchCase.switchLabel=new Label();
    if (switchVar || pattern.switchCheck()) {
      switchVar=true;
    }
    if (pattern.isExhaustive()) {
      defaultLabel=label;
      continue;
    }
    int min=pattern.minValue();
    if (min < low) {
      low=min;
    }
    int max=pattern.maxValue();
    if (max > high) {
      high=max;
    }
    cases+=pattern.switchCases();
  }
  Label endLabel=new Label();
  boolean matchError=false;
  if (defaultLabel == null) {
    if (!this.exhaustive) {
      switchVar=true;
      defaultLabel=new Label();
      matchError=true;
    }
 else {
      defaultLabel=endLabel;
    }
  }
  IType type=this.value.getType();
  this.value.writeExpression(writer,Types.INT);
  int varIndex=-1;
  if (switchVar) {
    varIndex=writer.localCount();
    writer.writeVarInsn(type.getStoreOpcode(),varIndex);
    writer.writeVarInsn(type.getLoadOpcode(),varIndex);
  }
  if (!type.isPrimitive()) {
    writer.writeInvokeInsn(Opcodes.INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
  int localCount=writer.localCount();
  if (useTableSwitch(low,high,cases)) {
    this.writeTableSwitch(writer,defaultLabel,low,high);
  }
 else {
    this.writeLookupSwitch(writer,defaultLabel,cases);
  }
  for (int i=0; i < this.caseCount; i++) {
    MatchCase matchCase=this.cases[i];
    writer.writeTargetLabel(matchCase.switchLabel);
    if (matchCase.condition != null) {
      matchCase.condition.writeInvJump(writer,defaultLabel);
    }
    if (matchCase.pattern.switchCheck()) {
      matchCase.pattern.writeInvJump(writer,varIndex,defaultLabel);
    }
    this.writeAction(writer,expr,frameType,matchCase.action);
    writer.resetLocals(localCount);
    writer.writeJumpInsn(Opcodes.GOTO,endLabel);
  }
  if (matchError) {
    writer.writeLabel(defaultLabel);
    this.writeMatchError(writer,varIndex,type);
  }
  writer.writeLabel(endLabel);
  if (switchVar) {
    writer.resetLocals(varIndex);
  }
}

Fixed version (ground truth):
private void generateSwitch(MethodWriter writer,boolean expr,Object frameType) throws BytecodeException {
  Label defaultLabel=null;
  int cases=0;
  int low=Integer.MAX_VALUE;
  int high=Integer.MIN_VALUE;
  boolean switchVar=false;
  for (int i=0; i < this.caseCount; i++) {
    MatchCase matchCase=this.cases[i];
    IPattern pattern=matchCase.pattern;
    Label label=matchCase.switchLabel=new Label();
    if (switchVar || pattern.switchCheck()) {
      switchVar=true;
    }
    if (pattern.isExhaustive()) {
      defaultLabel=label;
      continue;
    }
    int min=pattern.minValue();
    if (min < low) {
      low=min;
    }
    int max=pattern.maxValue();
    if (max > high) {
      high=max;
    }
    cases+=pattern.switchCases();
  }
  Label endLabel=new Label();
  boolean matchError=false;
  if (defaultLabel == null) {
    if (!this.exhaustive) {
      switchVar=true;
      defaultLabel=new Label();
      matchError=true;
    }
 else {
      defaultLabel=endLabel;
    }
  }
  IType type=this.value.getType();
  this.value.writeExpression(writer);
  int varIndex=-1;
  if (switchVar) {
    varIndex=writer.localCount();
    writer.writeVarInsn(type.getStoreOpcode(),varIndex);
    writer.writeVarInsn(type.getLoadOpcode(),varIndex);
  }
  if (!type.isPrimitive()) {
    writer.writeInvokeInsn(Opcodes.INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
  int localCount=writer.localCount();
  if (useTableSwitch(low,high,cases)) {
    this.writeTableSwitch(writer,defaultLabel,low,high);
  }
 else {
    this.writeLookupSwitch(writer,defaultLabel,cases);
  }
  for (int i=0; i < this.caseCount; i++) {
    MatchCase matchCase=this.cases[i];
    writer.writeTargetLabel(matchCase.switchLabel);
    if (matchCase.condition != null) {
      matchCase.condition.writeInvJump(writer,defaultLabel);
    }
    if (matchCase.pattern.switchCheck()) {
      matchCase.pattern.writeInvJump(writer,varIndex,defaultLabel);
    }
    this.writeAction(writer,expr,frameType,matchCase.action);
    writer.resetLocals(localCount);
    writer.writeJumpInsn(Opcodes.GOTO,endLabel);
  }
  if (matchError) {
    writer.writeLabel(defaultLabel);
    this.writeMatchError(writer,varIndex,type);
  }
  writer.writeLabel(endLabel);
  if (switchVar) {
    writer.resetLocals(varIndex);
  }
}