Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGFPE Error: packed_vector.hpp:996: void rebuild_rem(uint64_t j, uint8_t new_width_): Assert (size_ / int_per_word_ + (size_%int_per_word_!=0) <= words.size()) #29

Open
jikhashkya opened this issue Aug 20, 2024 · 0 comments

Comments

@jikhashkya
Copy link

jikhashkya commented Aug 20, 2024

Hi there @nicolaprezza,

I ran into this bug which seems to be triggered when deleting the last element from packed_spsi. It seems the last element cannot be a non-zero element in this specific instance. If I set the last element to zero before removing it, it seems to work fine (see the comment out code below). A similar issue seems to have been closed before so I'm not sure if this is related to that.

The following code should replicate the bug:

#include <iostream>
#include <random>
#include "dynamic/dynamic.hpp"

using namespace std;
using namespace dyn;

int main() {

  packed_spsi my_spsis;
  std::random_device rd;
  std::mt19937 mt(rd());
  std::uniform_int_distribution<std::mt19937::result_type> dist6(0,100); 
  cout << "Inserting random values: \n";
  for (int i = 0; i < 2000; ++i) {
    auto rand_val = static_cast<unsigned int>(dist6(mt));
    cout << i << ". Inserting val " << rand_val << "\n";
    my_spsis.push_back(rand_val);
  }

  cout << "Deleting random values: \n";
  for (int i = 0; i < 2000; ++i) {
    cout << i << ". Deleting \n";
    assert(my_spsis.size() > 0);
    // Uncomment to avoid the bug
    // if (my_spsis.size() == 1){
    //  my_spsis.set(0, 0);
    // }
    my_spsis.remove(0);
  }
}

Hope this gets fixed soon. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant