Commit e9e6db93 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix g++-12 -O2 -Wstringop-overflow

buf_pool_t::watch_unset(): Reorder some code so that
no warning will be emitted in CMAKE_BUILD_TYPE=RelWithDebInfo.
It is unclear why invoking watch_is_sentinel() before accessing
the block descriptor state would make the warning disappear.
parent 63f76d3b
......@@ -2160,17 +2160,21 @@ void buf_pool_t::watch_unset(const page_id_t id, buf_pool_t::hash_chain &chain)
buf_page_t *w;
{
transactional_lock_guard<page_hash_latch> g{page_hash.lock_get(chain)};
/* The page must exist because watch_set() increments buf_fix_count. */
/* The page must exist because watch_set() did fix(). */
w= page_hash.get(id, chain);
const auto state= w->state();
ut_ad(state >= buf_page_t::UNFIXED);
ut_ad(~buf_page_t::LRU_MASK & state);
ut_ad(w->in_page_hash);
if (state != buf_page_t::UNFIXED + 1 || !watch_is_sentinel(*w))
if (!watch_is_sentinel(*w))
{
w->unfix();
no_watch:
ut_d(const auto s=) w->unfix();
ut_ad(~buf_page_t::LRU_MASK & s);
w= nullptr;
}
const auto state= w->state();
ut_ad(~buf_page_t::LRU_MASK & state);
ut_ad(state >= buf_page_t::UNFIXED);
if (state != buf_page_t::UNFIXED + 1)
goto no_watch;
}
if (!w)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment