Program: 12303
Project: 12303
Buggy source:
/** 
 * reorder.cpp:398:restore_and_deallocate_saved_tests
 * @param value
 * @param tc
 * @param saved_tests
 */
private void restore_and_deallocate_saved_tests(Condition conds_list,int tc,SavedTest tests_to_restore){
  ListHead<Variable> new_vars=ListHead.newInstance();
  for (Condition cond=conds_list; cond != null; cond=cond.next) {
    if (cond.asConjunctiveNegationCondition() != null) {
      continue;
    }
    if (cond.asPositiveCondition() != null) {
      PositiveCondition pc=cond.asPositiveCondition();
      ByRef<Test> id_test=ByRef.create(pc.id_test);
      tests_to_restore=restore_saved_tests_to_test(id_test,true,tc,tests_to_restore);
      pc.id_test=id_test.value;
      pc.id_test.addBoundVariables(tc,new_vars);
      ByRef<Test> attr_test=ByRef.create(pc.attr_test);
      tests_to_restore=restore_saved_tests_to_test(attr_test,false,tc,tests_to_restore);
      pc.attr_test=attr_test.value;
      pc.attr_test.addBoundVariables(tc,new_vars);
      ByRef<Test> value_test=ByRef.create(pc.value_test);
      tests_to_restore=restore_saved_tests_to_test(value_test,false,tc,tests_to_restore);
      pc.value_test=value_test.value;
      pc.value_test.addBoundVariables(tc,new_vars);
    }
 else     if (cond.asNegativeCondition() != null) {
      NegativeCondition nc=cond.asNegativeCondition();
      ByRef<Test> id_test=ByRef.create(nc.id_test);
      tests_to_restore=restore_saved_tests_to_test(id_test,true,tc,tests_to_restore);
      nc.id_test=id_test.value;
      nc.id_test.addBoundVariables(tc,new_vars);
      ByRef<Test> attr_test=ByRef.create(nc.attr_test);
      tests_to_restore=restore_saved_tests_to_test(attr_test,false,tc,tests_to_restore);
      nc.attr_test=attr_test.value;
      nc.attr_test.addBoundVariables(tc,new_vars);
      ByRef<Test> value_test=ByRef.create(nc.value_test);
      tests_to_restore=restore_saved_tests_to_test(value_test,false,tc,tests_to_restore);
      nc.value_test=value_test.value;
      nc.value_test.addBoundVariables(tc,new_vars);
    }
  }
  if (tests_to_restore != null) {
    final Printer p=trace.getPrinter();
    if (p.isPrintWarnings()) {
      p.warn("String_Node_Str",prodName);
    }
  }
  Variable.unmark(new_vars);
}

Fixed version (ground truth):
/** 
 * reorder.cpp:398:restore_and_deallocate_saved_tests
 * @param value
 * @param tc
 * @param saved_tests
 */
private void restore_and_deallocate_saved_tests(Condition conds_list,int tc,SavedTest tests_to_restore){
  ListHead<Variable> new_vars=ListHead.newInstance();
  for (Condition cond=conds_list; cond != null; cond=cond.next) {
    if (cond.asConjunctiveNegationCondition() != null) {
      continue;
    }
    if (cond.asPositiveCondition() != null) {
      PositiveCondition pc=cond.asPositiveCondition();
      ByRef<Test> id_test=ByRef.create(pc.id_test);
      tests_to_restore=restore_saved_tests_to_test(id_test,true,tc,tests_to_restore,false);
      pc.id_test=id_test.value;
      pc.id_test.addBoundVariables(tc,new_vars);
      ByRef<Test> attr_test=ByRef.create(pc.attr_test);
      tests_to_restore=restore_saved_tests_to_test(attr_test,false,tc,tests_to_restore,false);
      pc.attr_test=attr_test.value;
      pc.attr_test.addBoundVariables(tc,new_vars);
      ByRef<Test> value_test=ByRef.create(pc.value_test);
      tests_to_restore=restore_saved_tests_to_test(value_test,false,tc,tests_to_restore,false);
      pc.value_test=value_test.value;
      pc.value_test.addBoundVariables(tc,new_vars);
    }
 else     if (cond.asNegativeCondition() != null) {
      NegativeCondition nc=cond.asNegativeCondition();
      ByRef<Test> id_test=ByRef.create(nc.id_test);
      tests_to_restore=restore_saved_tests_to_test(id_test,true,tc,tests_to_restore,true);
      nc.id_test=id_test.value;
      nc.id_test.addBoundVariables(tc,new_vars);
      ByRef<Test> attr_test=ByRef.create(nc.attr_test);
      tests_to_restore=restore_saved_tests_to_test(attr_test,false,tc,tests_to_restore,true);
      nc.attr_test=attr_test.value;
      nc.attr_test.addBoundVariables(tc,new_vars);
      ByRef<Test> value_test=ByRef.create(nc.value_test);
      tests_to_restore=restore_saved_tests_to_test(value_test,false,tc,tests_to_restore,true);
      nc.value_test=value_test.value;
      nc.value_test.addBoundVariables(tc,new_vars);
    }
  }
  if (tests_to_restore != null) {
    final Printer p=trace.getPrinter();
    if (p.isPrintWarnings()) {
      p.warn("String_Node_Str",prodName);
    }
  }
  Variable.unmark(new_vars);
}