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

Workaround to self move assign error with _GLIBCXX_DEBUG #47546

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

BrettDong
Copy link
Member

@BrettDong BrettDong commented Feb 16, 2021

Summary

Build "Workaround to self move assign error with _GLIBCXX_DEBUG"

Purpose of change

_GLIBCXX_DEBUG tests are failing (for example see https://travis-ci.org/github/CleverRaven/Cataclysm-DDA/jobs/758957947) because of a bug in libstdc++ (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85828) that when std::shuffle in src/item_group.cpp swaps an element to itself, the program is terminated with error

(crafting_skill_gain)=>	Error: attempt to self move assign.
(crafting_skill_gain)=>	
(crafting_skill_gain)=>	Objects involved in the operation:
(crafting_skill_gain)=>	    sequence "this" @ 0x0x12d31328 {
(crafting_skill_gain)=>	      type = __gnu_debug::_Safe_container<std::__debug::list<item_pocket, std::allocator<item_pocket> >, std::allocator<item_pocket>, __gnu_debug::_Safe_node_sequence, true>;
(crafting_skill_gain)=>	    }

Describe the solution

Add a workaround brought up by Jonathan Wakely in https://stackoverflow.com/questions/22915325/avoiding-self-assignment-in-stdshuffle that disables self move assignment check in libstdc++.

Describe alternatives you've considered

Disable _GLIBCXX_DEBUG test in Travis CI test matrix until GCC 11 is released.

Testing

Does not crash or error when compiling with CXXFLAGS=-D_GLIBCXX_DEBUG.

Additional context

The fix (https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c2fb0a1a2e7a0fb15cf3cf876f621902ccd273f0) is in GCC master branch and will be shipped with GCC 11 release.

@BrettDong BrettDong added Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` labels Feb 16, 2021
pch/main-pch.hpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants