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

_GLIBCXX_DEBUG causing runtime failure when --order rand #1384

Closed
thomasfanell opened this issue Sep 18, 2018 · 3 comments
Closed

_GLIBCXX_DEBUG causing runtime failure when --order rand #1384

thomasfanell opened this issue Sep 18, 2018 · 3 comments

Comments

@thomasfanell
Copy link

thomasfanell commented Sep 18, 2018

Description

If _GLIBCXX_DEBUG is defined during compilation, the following runtime error occur when the test executable is invoked with --order rand:

/usr/include/c++/7/debug/safe_container.h:83:
Error: attempt to self move assign.

Objects involved in the operation:
    sequence "this" @ 0x0x55d377712c78 {
      type = __gnu_debug::_Safe_container<std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_debug::_Safe_sequence, true>;
    }
Aborted (core dumped)

Steps to reproduce

Code

// main.cpp
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
TEST_CASE("A", "[bug]") { SECTION("a") { REQUIRE(true); } }
TEST_CASE("B", "[bug]") { SECTION("b") { REQUIRE(true); } }
TEST_CASE("C", "[bug]") { SECTION("c") { REQUIRE(true); } }
TEST_CASE("D", "[bug]") { SECTION("d") { REQUIRE(true); } }
TEST_CASE("E", "[bug]") { SECTION("e") { REQUIRE(true); } }
TEST_CASE("F", "[bug]") { SECTION("f") { REQUIRE(true); } }
int main(int argc, char* argv[])
{
    return Catch::Session().run(argc, argv);
}

Compile and run

  • g++-7 -std=c++14 -g -D_GLIBCXX_DEBUG main.cpp && ./a.out --rng-seed time --order rand
  • clang++-5.0 -std=c++14 -g -D_GLIBCXX_DEBUG main.cpp && ./a.out --rng-seed time --order rand

Extra information

  • Catch version: v2.4.0 (v2.2.2 fails too)
  • Operating System: Ubuntu 18.04 LTS
  • Compiler+version: g++ 7.3.0, clang 5.0.1
@horenmar
Copy link
Member

As far as I can tell, this is a bug in libstdc++. Depending on your PoV, it is either bug in the debug checker, or in its implementation of std::shuffle. Either way, I consider this a 3rd party bug that is not worth a workaround.

@horenmar horenmar added Resolved - pending review Issue waiting for feedback from the original author 3rd party bug labels Sep 20, 2018
@thomasfanell
Copy link
Author

It seems you're right. I must admit I managed to completely miss that SO post. I suppose we'll have to redirect __glibcxx_check_self_move_assign for now. Thanks for the link and my apologies for wasting your time.

@horenmar
Copy link
Member

Not a problem.

horenmar added a commit that referenced this issue Sep 21, 2018
This fixes some wording that implies C++98 standard, updates
the recommended solution to looped SECTION macros and mentioned
the "last section failed, test needs to be rerun" problem.

Related to #1367
Related to #1384
Related to #1389
@horenmar horenmar removed the Resolved - pending review Issue waiting for feedback from the original author label Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants