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

MDEV-18878: Fix GCC -flifetime-dse

GCC 6 and later can optimize away the memset() that is part of
mem_heap_zalloc() in a placement new call. So, instead of relying
on that kind of initialization, explicitly initialize the necessary
fields in the constructors.

que_common_t::que_common_t(): Initialize more fields in the
default constructor.

purge_vcol_info_t::purge_vcol_info_t(): Initialize all fields in
the default constructor.

purge_node_t::purge_node_t(): Initialize all necessary fields.

Reference:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71388

    https://gcc.gnu.org/ml/gcc/2016-02/msg00207.html
parent e374755b
...@@ -87,8 +87,9 @@ struct que_common_t{ ...@@ -87,8 +87,9 @@ struct que_common_t{
explicitly */ explicitly */
/** Constructor */ /** Constructor */
que_common_t(ulint type, que_node_t* parent) que_common_t(ulint type, que_node_t* parent) :
: type(type), parent(parent), brother(), val(), val_buf_size() type(type), parent(parent), brother(NULL),
val(), val_buf_size(0)
{} {}
}; };
......
...@@ -133,7 +133,14 @@ struct purge_node_t{ ...@@ -133,7 +133,14 @@ struct purge_node_t{
/** Constructor */ /** Constructor */
explicit purge_node_t(que_thr_t* parent) : explicit purge_node_t(que_thr_t* parent) :
common(QUE_NODE_PURGE, parent), heap(mem_heap_create(256)) common(QUE_NODE_PURGE, parent),
undo_recs(NULL),
unavailable_table_id(0),
heap(mem_heap_create(256)),
#ifdef UNIV_DEBUG
in_progress(false),
#endif
vcol_info()
{} {}
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
......
...@@ -69,6 +69,11 @@ struct purge_vcol_info_t ...@@ -69,6 +69,11 @@ struct purge_vcol_info_t
TABLE* mariadb_table; TABLE* mariadb_table;
public: public:
/** Default constructor */
purge_vcol_info_t() :
requested(false), used(false), first_use(false),
mariadb_table(NULL)
{}
/** Reset the state. */ /** Reset the state. */
void reset() void reset()
{ {
......
...@@ -182,7 +182,7 @@ purge_graph_build() ...@@ -182,7 +182,7 @@ purge_graph_build()
for (ulint i = 0; i < srv_n_purge_threads; ++i) { for (ulint i = 0; i < srv_n_purge_threads; ++i) {
que_thr_t* thr = que_thr_create(fork, heap, NULL); que_thr_t* thr = que_thr_create(fork, heap, NULL);
thr->child = new(mem_heap_zalloc(heap, sizeof(purge_node_t))) thr->child = new(mem_heap_alloc(heap, sizeof(purge_node_t)))
purge_node_t(thr); purge_node_t(thr);
} }
......
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