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

Bug in flat_hash_map.hpp #39

Open
ammaraslam10 opened this issue Oct 16, 2020 · 1 comment
Open

Bug in flat_hash_map.hpp #39

ammaraslam10 opened this issue Oct 16, 2020 · 1 comment

Comments

@ammaraslam10
Copy link

image

Worked fine in debug mode..

@NRUB
Copy link

NRUB commented Dec 9, 2020

This bug is related to x86. It is indeed crashing, in my case after 1024 allocations as it calls:
emplace ->
emplace_new_key ->
grow ->
rehash ->
emplace ->
emplace_new_key ->
grow ->
rehash ->
emplace
and there on line
/*line 581*/ for (; current_entry->distance_from_desired >= distance_from_desired; ++current_entry, ++distance_from_desired)
it throws read access violation on current_entry.

Tested under VS Community 2019 (16.8.3) /std::c++latest as well as /std:c++17, debug, no optimizations.

SSCCE:

#include <memory>
#include "flat_hash_map.hpp"

class F {
public:
	double a;
};

int main () {
	ska::flat_hash_map<int, std::shared_ptr<F>> map;
	for (int i = 0; i < 250000; ++i) {
		map.emplace(i, std::make_shared<F>());
	}
	return 0;
}

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

2 participants