From e3a7f75aefb882a291b7308d84e8a36b34d3009f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 10 May 2017 14:14:50 +0300 Subject: MDEV-12679 purge_sys_t::~purge_sys_t(): Assertion `latch.magic_n == 0' failed on --bootstrap (CMAKE_BUILD_TYPE=Debug) rw_lock_free_func(): Assign lock->magic_n = 0 in debug builds, because sometimes, the assignment in the explicit destructor call is being optimized away. This was verified when using GCC 6.3.0 with -O3 -g -mtune=native on a Debian GNU/Linux 9.0 system on AMD64. --- storage/innobase/sync/sync0rw.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index c748bad1417..6322b14335f 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -277,6 +277,9 @@ rw_lock_free_func( /* We did an in-place new in rw_lock_create_func() */ ut_d(lock->~rw_lock_t()); + /* Sometimes (maybe when compiled with GCC -O3) the above call + to rw_lock_t::~rw_lock_t() will not actually assign magic_n=0. */ + ut_d(lock->magic_n = 0); } /******************************************************************//** -- cgit v1.2.1