Skip to content

Commit

Permalink
fix hhbbc assertion failure on MacOS
Browse files Browse the repository at this point in the history
Summary:
```
Assertion failure: /tmp/hhvm-4.11-20190624-29824-15nb7r5/hhvm-4.11.0/hphp/compiler/analysis/analysis_result.cpp:53: HPHP::AnalysisResult::~AnalysisResult(): assertion `!m_finish' failed.

* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x00007fff6c6592c6 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff6c70ebf1 libsystem_pthread.dylib`pthread_kill + 284
    frame #2: 0x00007fff6c576d8a libsystem_c.dylib`raise + 26
    frame #3: 0x00000000063f3a0f hhvm`HPHP::bt_handler(int, __siginfo*, void*) + 1655
    frame #4: 0x00007fff6c703b5d libsystem_platform.dylib`_sigtramp + 29
    frame #5: 0x00007fff6c6592c7 libsystem_kernel.dylib`__pthread_kill + 11
    frame #6: 0x00007fff6c70ebf1 libsystem_pthread.dylib`pthread_kill + 284
    frame #7: 0x00007fff6c5c36a6 libsystem_c.dylib`abort + 127
    frame #8: 0x0000000004df327f hhvm`HPHP::assert_fail(char const*, char const*, unsigned int, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 267
    frame #9: 0x0000000004dacd05 hhvm`HPHP::AnalysisResult::~AnalysisResult() + 189
    frame #10: 0x0000000004dae03e hhvm`HPHP::Compiler::emitAllHHBC(std::__1::shared_ptr<HPHP::AnalysisResult>&&) + 500
    frame #11: 0x0000000002c10b87 hhvm`HPHP::hhbcTarget(HPHP::CompilerOptions const&, std::__1::shared_ptr<HPHP::AnalysisResult>&&, HPHP::AsyncFileCacheSaver&) + 753
    frame #12: 0x0000000002c0fdb7 hhvm`HPHP::process(HPHP::CompilerOptions const&) + 2152
    frame #13: 0x0000000002c0ce34 hhvm`HPHP::compiler_main(int, char**) + 489
    frame #14: 0x00007fff6c51e3d5 libdyld.dylib`start + 1
```

Given our Linux clang builds are fine, likely libc++ vs libstdc++ issue.

markw65 found - in the standard:

> For (4), other is in a valid but unspecified state after the call

Reviewed By: markw65

Differential Revision: D15997122

fbshipit-source-id: c72950e1365f1141445794608f9e56f1c5d6ed89
  • Loading branch information
fredemmott committed Aug 7, 2019
1 parent a77bfb3 commit 671df42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hphp/compiler/analysis/analysis_result.cpp
Expand Up @@ -55,7 +55,10 @@ AnalysisResult::~AnalysisResult() {

void AnalysisResult::finish() {
if (m_finish) {
auto f = std::move(m_finish);
// std::move leaves a std::function in a valid, but
// unspecified state. Don't try to replace this with a std::move
decltype(m_finish) f;
f.swap(m_finish);
f(shared_from_this());
}
}
Expand Down

0 comments on commit 671df42

Please sign in to comment.