diff --git a/.github/workflows/build_matrix.yml b/.github/workflows/build_matrix.yml index 9f5a3b01..1cf1cc86 100644 --- a/.github/workflows/build_matrix.yml +++ b/.github/workflows/build_matrix.yml @@ -33,6 +33,14 @@ jobs: cxx: "g++", generators: "Ninja" } + - { + name: "ubuntu g++ asan+ubsan", + os: ubuntu-latest, + build_type: "Debug", + cxx: "g++", + generators: "Ninja", + cxx_flags: "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -g" + } - { name: "macos clang++", os: macos-latest, @@ -80,6 +88,7 @@ jobs: -B . \ -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \ + -DCMAKE_CXX_FLAGS="${{ matrix.config.cxx_flags }}" \ -DSML_BUILD_EXAMPLES=ON \ -DSML_BUILD_TESTS=ON \ -G "${{ matrix.config.generators }}" diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp index 29a46592..0807cd90 100644 --- a/include/boost/sml.hpp +++ b/include/boost/sml.hpp @@ -2309,7 +2309,10 @@ struct sm_impl : aux::conditional_t(process_.front())}; process_.pop(); // pop before dispatch so re-entrant calls see an advanced queue (#465) - queued_handled &= (this->*dispatch_table[event.id])(d, subs, event.data); + // Subscript in its own statement to dodge a GCC(-O0) ASan+UBSan miscompilation/crash on + // the folded (this->*dispatch_table[event.id])(...) call. + const auto handler = dispatch_table[event.id]; + queued_handled &= (this->*handler)(d, subs, event.data); } return wasnt_empty; }