Program: 83223
Project: 83223
Buggy source:
private void write(MethodWriter writer,boolean expr) throws BytecodeException {
  int varIndex=writer.localCount();
  IType type=this.value.getType();
  this.value.writeExpression(writer);
  writer.writeVarInsn(type.getStoreOpcode(),varIndex);
  int localCount=writer.localCount();
  Object frameType=expr ? this.type.getFrameType() : null;
  Label elseLabel=new Label();
  Label endLabel=new Label();
  for (int i=0; i < this.caseCount; ) {
    MatchCase c=this.cases[i];
    IPattern pattern=c.pattern;
    IValue condition=c.condition;
    IValue value=c.action;
    pattern.writeInvJump(writer,varIndex,elseLabel);
    if (condition != null) {
      condition.writeInvJump(writer,elseLabel);
    }
    if (value != null) {
      if (expr) {
        value.writeExpression(writer);
        writer.getFrame().set(frameType);
      }
 else {
        value.writeStatement(writer);
      }
    }
 else     if (expr) {
      this.type.writeDefaultValue(writer);
    }
    writer.resetLocals(localCount);
    writer.writeJumpInsn(Opcodes.GOTO,endLabel);
    writer.writeLabel(elseLabel);
    if (++i < this.caseCount) {
      elseLabel=new Label();
    }
  }
  writer.writeLabel(elseLabel);
  if (!this.exhaustive) {
    writer.writeTypeInsn(Opcodes.NEW,"String_Node_Str");
    writer.writeInsn(Opcodes.DUP);
    writer.writeVarInsn(type.getLoadOpcode(),varIndex);
    String desc="String_Node_Str" + (type.isPrimitive() ? type.getExtendedName() + "String_Node_Str" : "String_Node_Str");
    writer.writeInvokeInsn(Opcodes.INVOKESPECIAL,"String_Node_Str","String_Node_Str",desc,false);
    writer.writeInsn(Opcodes.ATHROW);
    writer.setHasReturn(false);
  }
  writer.writeLabel(endLabel);
  writer.resetLocals(varIndex);
}

Fixed version (ground truth):
private void write(MethodWriter writer,boolean expr) throws BytecodeException {
  int varIndex=writer.localCount();
  IType type=this.value.getType();
  this.value.writeExpression(writer);
  writer.writeVarInsn(type.getStoreOpcode(),varIndex);
  int localCount=writer.localCount();
  Object frameType=expr ? this.type.getFrameType() : null;
  Label elseLabel=new Label();
  Label endLabel=new Label();
  for (int i=0; i < this.caseCount; ) {
    MatchCase c=this.cases[i];
    IPattern pattern=c.pattern;
    IValue condition=c.condition;
    IValue value=c.action;
    pattern.writeInvJump(writer,varIndex,elseLabel);
    if (condition != null) {
      condition.writeInvJump(writer,elseLabel);
    }
    if (value != null) {
      if (expr) {
        value.writeExpression(writer);
        writer.getFrame().set(frameType);
      }
 else {
        value.writeStatement(writer);
      }
    }
 else     if (expr) {
      this.type.writeDefaultValue(writer);
    }
    writer.resetLocals(localCount);
    writer.writeJumpInsn(Opcodes.GOTO,endLabel);
    writer.writeLabel(elseLabel);
    if (++i < this.caseCount) {
      elseLabel=new Label();
    }
  }
  writer.writeLabel(elseLabel);
  if (!this.exhaustive) {
    writer.writeTypeInsn(Opcodes.NEW,"String_Node_Str");
    writer.writeInsn(Opcodes.DUP);
    writer.writeVarInsn(type.getLoadOpcode(),varIndex);
    String desc="String_Node_Str" + (type.isPrimitive() ? type.getExtendedName() + "String_Node_Str" : "String_Node_Str");
    writer.writeLineNumber(this.getLineNumber());
    writer.writeInvokeInsn(Opcodes.INVOKESPECIAL,"String_Node_Str","String_Node_Str",desc,false);
    writer.writeInsn(Opcodes.ATHROW);
    writer.setHasReturn(false);
  }
  writer.writeLabel(endLabel);
  writer.resetLocals(varIndex);
}