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

Runner Example Segfaults #271

Closed
jwillikers opened this issue Dec 31, 2019 · 5 comments
Closed

Runner Example Segfaults #271

jwillikers opened this issue Dec 31, 2019 · 5 comments

Comments

@jwillikers
Copy link
Contributor

jwillikers commented Dec 31, 2019

Expected Behavior

The runner example should build and run successfully.

Actual Behavior

The runner example program segfaults.

Steps to Reproduce the Problem

  1. mkdir build
  2. cmake ..
  3. cmake --build .

Specifications

  • Version: Current master (commit hash 35ac252)
  • Platform: macOS 10.15 Catalina
  • Toolchain: CMake 3.16.2 / Ninja / XCode / MacPorts LLVM Clang 9.0.0
@kris-jusiak
Copy link
Contributor

@athrun22 can you provide call stack/core file or something to be able to track it down, please?

@jwillikers
Copy link
Contributor Author

Does this stack trace of the segfault from LLDB work?

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fff65e0bc92 libsystem_platform.dylib`_platform_strlen + 18
    frame #1: 0x00007fff62d33a87 libc++.1.dylib`std::runtime_error::runtime_error(char const*) + 39
    frame #2: 0x00000001000017a9 runner`main::$_0::operator(this=0x00007ffeefbff410)() const::'lambda'()::operator()() const at runner.cpp:39:30
    frame #3: 0x0000000100001738 runner`boost::ut::v1_1_5::detail::throws_<main::$_0::operator()() const::'lambda'(), void>::throws_(this=0x00007ffeefbff318)() const::'lambda'() const&)::'lambda'()::operator()() const at ut.hpp:802:13
    frame #4: 0x0000000100001709 runner`boost::ut::v1_1_5::detail::throws_<main::$_0::operator()() const::'lambda'(), void>::throws_(this=0x00007ffeefbff368, expr=0x00007ffeefbff410)() const::'lambda'() const&) at ut.hpp:800:16
    frame #5: 0x00000001000016cd runner`boost::ut::v1_1_5::detail::throws_<main::$_0::operator()() const::'lambda'(), void>::throws_(this=0x00007ffeefbff368, expr=0x00007ffeefbff410)() const::'lambda'() const&) at ut.hpp:807:14
    frame #6: 0x0000000100001449 runner`auto boost::ut::v1_1_5::throws<main::$_0::operator()() const::'lambda'()>(expr=0x00007ffeefbff410)() const::'lambda'() const&) at ut.hpp:1900:10
    frame #7: 0x00000001000012a8 runner`main::$_0::operator(this=0x0000000100001280)() const at runner.cpp:39:12
    frame #8: 0x0000000100001289 runner`main::$_0::__invoke() at runner.cpp:38:30
    frame #9: 0x0000000100001d93 runner`boost::ut::v1_1_5::events::test<void (*)(), boost::ut::v1_1_5::none>::run_impl(test=(runner`main::$_0::__invoke() at runner.cpp:38), (null)=0x00007ffeefbff4e0)(), boost::ut::v1_1_5::none const&) at ut.hpp:878:60
    frame #10: 0x0000000100001d72 runner`boost::ut::v1_1_5::events::test<void (*)(), boost::ut::v1_1_5::none>::operator(this=0x00007ffeefbff4b0)() at ut.hpp:874:33
    frame #11: 0x0000000100001d48 runner`auto cfg::runner::on<void (*)(), boost::ut::v1_1_5::none>(this=0x0000000100003120, test=test<void (*)(), boost::ut::v1_1_5::none> @ 0x00007ffeefbff4b0)(), boost::ut::v1_1_5::none>) at runner.cpp:17:5
    frame #12: 0x0000000100001d25 runner`decltype(event=0x00007ffeefbff558) boost::ut::v1_1_5::detail::on<boost::ut::v1_1_5::events::test<void (*)(), boost::ut::v1_1_5::none> >(boost::ut::v1_1_5::events::test<void (*)(), boost::ut::v1_1_5::none>&&) at ut.hpp:1485:73
    frame #13: 0x00000001000011b5 runner`auto boost::ut::v1_1_5::detail::test::operator=<>(this=0x00007ffeefbff5d0, test=test_location<void (*)()> @ 0x00007ffeefbff5b0)()>) at ut.hpp:1507:5
    frame #14: 0x0000000100001088 runner`main at runner.cpp:38:28
    frame #15: 0x00007fff65c157fd libdyld.dylib`start + 1```

kris-jusiak added a commit that referenced this issue Dec 31, 2019
Problem:
- `runtime_error` with an empty `{}` is being thrown causing UB.
- There is missing `stdexcept` include.

Solution:
- Use a `"exception!"` string instead.
- Add missing include.
@kris-jusiak
Copy link
Contributor

Thanks @athrun22, can you please check whether the following fix works for you 🤔 -> #272

@jwillikers
Copy link
Contributor Author

@krzysztof-jusiak, the runner example no longer segfaults. Again, thank you for the speedy response! 🏎

@kris-jusiak
Copy link
Contributor

Perfect, thank you @athrun22, I'll try to add mac/clang to the CI matrix to be able to track these issues.

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