Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Segfault on sparse lists #3

@richardstartin

Description

@richardstartin

The function below segfaults, but works fine with dense lists (my compiler is gcc 7.2.0, OS Windows). Please confirm if you can reproduce this or if I have done something silly.

#include <stdio.h>
#include <string.h>
#include "skiplist.h"

void sanity_test() {
  _CSSL_SkipList* slist = createSkipList(9, 5);
  for (int i = 0; i < 100000; i += 1000) {
    insertElement(slist, i);
  }
  _CSSL_RangeSearchResult result = searchRange(slist, 500, 2500);
  printf("Result = %d", result.count);
  printf("First = %d", result.start->key);
  printf("Last = %d", result.end->key);
}

Adding every hundredth integer to the skip list produces an incorrect number of matches (0, 20 expected), but does not segfault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions