diff --git a/include/boost/regex/v5/perl_matcher_non_recursive.hpp b/include/boost/regex/v5/perl_matcher_non_recursive.hpp index 87400452..5a1c3f4c 100644 --- a/include/boost/regex/v5/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v5/perl_matcher_non_recursive.hpp @@ -237,8 +237,8 @@ void perl_matcher::extend_stack() saved_state* backup_state; stack_base = static_cast(get_mem_block()); backup_state = reinterpret_cast(reinterpret_cast(stack_base)+BOOST_REGEX_BLOCKSIZE); - saved_extra_block* block = static_cast(backup_state); - --block; + saved_extra_block* block = reinterpret_cast( + reinterpret_cast(backup_state) - sizeof(saved_extra_block)); (void) new (block) saved_extra_block(m_stack_base, m_backup_state); m_stack_base = stack_base; m_backup_state = block;