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

SEGV after moving hash_map #83

Open
diameter opened this issue Sep 17, 2019 · 2 comments
Open

SEGV after moving hash_map #83

diameter opened this issue Sep 17, 2019 · 2 comments

Comments

@diameter
Copy link

Linux/Darwin gcc/clang MWE

spp::sparse_hash_map<uint64_t, uint64_t> map0;
map0.emplace(0, 0);
auto map1 = std::move(map0);
//map0 = spp::sparse_hash_map<uint64_t, uint64_t>{}; // uncomment this to pass the test
auto found = map0.find(0); // segfaults here
CHECK(found == end(map0));
@rob-p
Copy link
Contributor

rob-p commented Jan 8, 2020

What is the intended behavior here? A moved-from object is generally assumed to be in an undefined state. Presumably, this means that it can still be validly-destructed, but you can't do much else with it. I guess, the most robust behavior would be for the moved-from map to be empty ; is that what you would expect? Any thoughts @greg7mdp?

@greg7mdp
Copy link
Owner

greg7mdp commented Jan 8, 2020

@rob-p yes indeed the moved-from object should be in a consistent state, so this is a bug. I'll look into it when I have some time. In the meanwhile maybe phmap is a good alternative.

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

3 participants