back11: undefined behaviour (reported by llvm 18)
- Dominant language
- C++
- Stars
- 40
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Compiler: clang++-18
Boost: version 1.86.0
I have the following statemachine:
```c++
#include
#include
#include
#include
namespace msm = boost::msm;
using namespace msm::front;
using namespace msm::front::puml;
namespace boost::msm::front::puml {
// Actions
template <> struct Action {
template
void operator()(const Event &, FSM &, SourceState &, TargetState &) {
std::cout << "server connected" << std::endl;
}
};
} // namespace boost::msm::front::puml
struct server_ : public msm::front::state_machine_def {
int chain_id{0};
int job_id{0};
BOOST_MSM_PUML_DECLARE_TABLE(R"(
@startuml server
state Server {
[*] --> Initial
Initial --> Connected : connected / a_connected
}
@enduml
)")
};
using server = msm::back11::state_machine;
using connected = Event;
int main(int, char **) {
// server
server sm;
sm.process_event(connected{});
return 0;
}
```
When compiling and executing:
```c++
$ /usr/bin/clang++-18 -isystem /home/matthijs/src/boost/boost_1_86_0 -fno-omit-frame-pointer -O1 -fsanitize=address,undefined,pointer-compare,pointer-subtract,leak -fsanitize-address-use-after-scope -Wall -Wextra -g -std=gnu++20 ../main.cpp -o main
$ ./main
/home/matthijs/src/boost/boost_1_86_0/boost/msm/back11/state_machine.hpp:2171:21: runtime error: call to function boost::msm::back11::state_machine::a_row_, boost::fusion::vector<>, boost::fusion::vector<>>, boost::msm::front::puml::Event<3846760266u>, boost::msm::front::puml::State<1740203497u, boost::fusion::vector<>, boost::fusion::vector<>, boost::fusion::vector<>>, boost::msm::front::puml::Action<2978207285u>, boost::msm::front::none>>::execute(boost::msm::back11::state_machine&, int, int, boost::msm::front::puml::Event<3846760266u> const&) through pointer to incorrect function type 'boost::msm::back::HandledEnum (*)(boost::msm::back11::state_machine &, int, int, boost::msm::front::puml::Event<3846760266> &)'
/home/matthijs/src/boost/boost_1_86_0/boost/msm/back11/state_machine.hpp:590: note: boost::msm::back11::state_machine::a_row_, boost::fusion::vector<>, boost::fusion::vector<>>, boost::msm::front::puml::Event<3846760266u>, boost::msm::front::puml::State<1740203497u, boost::fusion::vector<>, boost::fusion::vector<>, boost::fusion::vector<>>, boost::msm::front::puml::Action<2978207285u>, boost::msm::front::none>>::execute(boost::msm::back11::state_machine&, int, int, boost::msm::front::puml::Event<3846760266u> const&) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthijs/src/boost/boost_1_86_0/boost/msm/back11/state_machine.hpp:2171:21
server connected
```
I am not sure if this is a serious problem. If you need more information let me know.
Regards, Matthijs
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.