From d63fcbc2f07bb51ea4a5424361deef319da9bd39 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 3 Sep 2020 15:26:55 +0000 Subject: [PATCH 1/3] MDEV-23661: RocksDB produces "missing initializer for member" warnings Add -Wno-missing-field-initializers for MyRocks and gcc version below 5.0 --- storage/rocksdb/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 506dead7a6e..a82794e9f07 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -54,6 +54,9 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}") ENDIF() SET(CXX11_FLAGS "-std=c++11") + IF (GCC_VERSION VERSION_LESS 5.0) + SET(CXX11_FLAGS "-Wno-missing-field-initializers") + ENDIF() ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3)) From 8c2909a2a4629f542a52b12cc41bcbf6c36fc588 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 4 Sep 2020 09:12:27 +0000 Subject: [PATCH 2/3] Fix a typo in the previous cset --- storage/rocksdb/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index a82794e9f07..f9384848243 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -55,7 +55,7 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") ENDIF() SET(CXX11_FLAGS "-std=c++11") IF (GCC_VERSION VERSION_LESS 5.0) - SET(CXX11_FLAGS "-Wno-missing-field-initializers") + SET(CXX11_FLAGS "-std=c++11 -Wno-missing-field-initializers") ENDIF() ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR From c029d4562322d8c792f96717e0fb7f18d2379b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 4 Sep 2020 12:07:46 +0300 Subject: [PATCH 3/3] MDEV-23600 follow-up: uninitialized rec_field_is_prefix build_template_field(): Initialize templ->rec_field_is_prefix also for indexes on virtual columns. This was caught on 10.5 by MemorySanitizer as use-of-uninitialized-value in row_search_with_covering_prefix() when running the test main.fast_prefix_index_fetch_innodb. --- storage/innobase/handler/ha_innodb.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e171b6a99b3..2493a11b554 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7455,6 +7455,8 @@ build_template_field( #ifdef HAVE_valgrind_or_MSAN MEM_UNDEFINED(templ, sizeof *templ); #endif /* HAVE_valgrind_or_MSAN */ + templ->rec_field_is_prefix = FALSE; + templ->rec_prefix_field_no = ULINT_UNDEFINED; templ->is_virtual = !field->stored_in_db(); if (!templ->is_virtual) { @@ -7516,8 +7518,6 @@ build_template_field( << " query " << innobase_get_stmt_unsafe(current_thd, &size); } - templ->rec_field_is_prefix = FALSE; - templ->rec_prefix_field_no = ULINT_UNDEFINED; if (dict_index_is_clust(index)) { templ->rec_field_no = templ->clust_rec_field_no; @@ -7535,7 +7535,6 @@ build_template_field( DBUG_ASSERT(!ha_innobase::omits_virtual_cols(*table->s)); col = &dict_table_get_nth_v_col(index->table, v_no)->m_col; templ->clust_rec_field_no = v_no; - templ->rec_prefix_field_no = ULINT_UNDEFINED; if (dict_index_is_clust(index)) { templ->rec_field_no = templ->clust_rec_field_no;