boostorg / boostorg/statechart

pointer used after 'void operator delete(void*, std::size_t)' in simple_state.hpp

Open
#22 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
32
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Switching recently from GCC 11 to 12 (MinGW), we encountered the following new warning:

```
inlined from 'boost::statechart::detail::reaction_result boost::statechart::simple_state::react_impl(const event_base_type&, typename Context::inner_context_type::rtti_policy_type::id_type) [with MostDerived = ourstuff::{anonymous}::OurStuff Context = ourstuff::{anonymous}::OurStuff; InnerInitial = boost::mpl::list; boost::statechart::history_mode historyMode = boost::statechart::has_no_history]' at C:/.../boost-1_80/boost/statechart/simple_state.hpp:489:37:

C:/.../boost-1_80/boost/statechart/detail/counted_base.hpp:80:27: error: pointer used after 'void operator delete(void*, std::size_t)' [-Werror=use-after-free]

80 | return --base_type::count_ == 0;
```

This happens only in the "RelWithDebInfo" CMake configuration.

As a workaround, we patched this file to disable the warning using a #pragma, since warnings are considered as errors in this project.

This is the code producing the warning in context, for reference:
```
bool release() const
{
BOOST_ASSERT( base_type::count_ > 0 );
return --base_type::count_ == 0;
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.