Skip to content

Commit

Permalink
Fix g++-12 -O2 -Wstringop-overflow
Browse files Browse the repository at this point in the history
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
buf_fix_count() would make the warning disappear.
  • Loading branch information
dr-m committed Mar 29, 2022
1 parent d62b036 commit c14f60a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions storage/innobase/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2383,10 +2383,8 @@ void buf_pool_t::watch_unset(const page_id_t id)
page_hash_latch *hash_lock= page_hash.lock<true>(fold);
/* The page must exist because watch_set() increments buf_fix_count. */
buf_page_t *w= page_hash_get_low(id, fold);
const auto buf_fix_count= w->buf_fix_count();
ut_ad(buf_fix_count);
const bool must_remove= buf_fix_count == 1 && watch_is_sentinel(*w);
ut_ad(w->in_page_hash);
const bool must_remove= watch_is_sentinel(*w) && w->buf_fix_count() == 1;
if (!must_remove)
w->unfix();
hash_lock->write_unlock();
Expand Down

0 comments on commit c14f60a

Please sign in to comment.