summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-12 13:56:58 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-12 13:56:58 +0200
commite070cfe398072b6020193f7eac5c3a1f7281979b (patch)
treec6e1d0cd829ba6a840acd20ff6a9a6305d27b983
parente374755baeec2c79ecc3b6919f688af6e14a151f (diff)
downloadmariadb-git-e070cfe398072b6020193f7eac5c3a1f7281979b.tar.gz
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
-rw-r--r--storage/innobase/include/que0types.h5
-rw-r--r--storage/innobase/include/row0purge.h9
-rw-r--r--storage/innobase/include/row0types.h5
-rw-r--r--storage/innobase/trx/trx0purge.cc2
4 files changed, 17 insertions, 4 deletions
diff --git a/storage/innobase/include/que0types.h b/storage/innobase/include/que0types.h
index 2b5a04811b3..29134145c35 100644
--- a/storage/innobase/include/que0types.h
+++ b/storage/innobase/include/que0types.h
@@ -87,8 +87,9 @@ struct que_common_t{
explicitly */
/** Constructor */
- que_common_t(ulint type, que_node_t* parent)
- : type(type), parent(parent), brother(), val(), val_buf_size()
+ que_common_t(ulint type, que_node_t* parent) :
+ type(type), parent(parent), brother(NULL),
+ val(), val_buf_size(0)
{}
};
diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h
index 83babd18390..97296831211 100644
--- a/storage/innobase/include/row0purge.h
+++ b/storage/innobase/include/row0purge.h
@@ -133,7 +133,14 @@ public:
/** Constructor */
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
diff --git a/storage/innobase/include/row0types.h b/storage/innobase/include/row0types.h
index d2aef89f695..84afbbc3ec7 100644
--- a/storage/innobase/include/row0types.h
+++ b/storage/innobase/include/row0types.h
@@ -69,6 +69,11 @@ private:
TABLE* mariadb_table;
public:
+ /** Default constructor */
+ purge_vcol_info_t() :
+ requested(false), used(false), first_use(false),
+ mariadb_table(NULL)
+ {}
/** Reset the state. */
void reset()
{
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 18ebbc4aeee..6c963003e05 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -182,7 +182,7 @@ purge_graph_build()
for (ulint i = 0; i < srv_n_purge_threads; ++i) {
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);
}