diff --git a/ft/ft-flusher.cc b/ft/ft-flusher.cc index f759e7a3594..2350a915d89 100644 --- a/ft/ft-flusher.cc +++ b/ft/ft-flusher.cc @@ -783,7 +783,8 @@ move_leafentries( *num_bytes_moved = 0; for (i = lbi; i < ube; i++) { OMTVALUE lev; - toku_omt_fetch(src_bn->buffer, i, &lev); + int r = toku_omt_fetch(src_bn->buffer, i, &lev); + assert_zero(r); LEAFENTRY CAST_FROM_VOIDP(curr_le, lev); size_t le_size = leafentry_memsize(curr_le); *num_bytes_moved += leafentry_disksize(curr_le); @@ -851,7 +852,7 @@ ftleaf_split( } - FTNODE B; + FTNODE B = nullptr; uint32_t fullhash; BLOCKNUM name; @@ -875,6 +876,9 @@ ftleaf_split( &fullhash, &B ); + // GCC 4.8 seems to get confused and think B is maybe uninitialized at link time. + // TODO(leif): figure out why it thinks this and actually fix it. + invariant_notnull(B); } @@ -1245,7 +1249,8 @@ merge_leaf_nodes(FTNODE a, FTNODE b) // fill in pivot for what used to be max of node 'a', if it is needed if (a_has_tail) { OMTVALUE lev; - toku_omt_fetch(a_last_buffer, toku_omt_size(a_last_buffer) - 1, &lev); + int r = toku_omt_fetch(a_last_buffer, toku_omt_size(a_last_buffer) - 1, &lev); + assert_zero(r); LEAFENTRY CAST_FROM_VOIDP(le, lev); uint32_t keylen; void *key = le_key_and_len(le, &keylen); diff --git a/ft/ft-ops.cc b/ft/ft-ops.cc index ea5671fab06..72b5773b068 100644 --- a/ft/ft-ops.cc +++ b/ft/ft-ops.cc @@ -4050,13 +4050,14 @@ ft_cursor_extract_key_and_val(LEAFENTRY le, *val = le; *vallen = leafentry_memsize(le); } else if (cursor->is_snapshot_read) { - le_iterate_val( + int r = le_iterate_val( le, does_txn_read_entry, val, vallen, cursor->ttxn ); + lazy_assert_zero(r); *key = le_key_and_len(le, keylen); } else { *key = le_key_and_len(le, keylen); diff --git a/ft/ft.cc b/ft/ft.cc index bab92dda628..7aaaa79004e 100644 --- a/ft/ft.cc +++ b/ft/ft.cc @@ -474,7 +474,7 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE brt, CACHEFILE cf, LSN max_ac } } *was_open = false; - FT h; + FT h = nullptr; int r; { int fd = toku_cachefile_get_fd(cf); @@ -485,6 +485,8 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE brt, CACHEFILE cf, LSN max_ac } } if (r!=0) return r; + // GCC 4.8 seems to get confused by the gotos in the deserialize code and think h is maybe uninitialized. + invariant_notnull(h); h->cf = cf; h->compare_fun = brt->options.compare_fun; h->update_fun = brt->options.update_fun; diff --git a/ft/logger.cc b/ft/logger.cc index 64a1757412b..7fb6107462f 100644 --- a/ft/logger.cc +++ b/ft/logger.cc @@ -1014,8 +1014,9 @@ int toku_fread_TXNID (FILE *f, TXNID *txnid, struct x1764 *checksum, uint32_t int toku_fread_TXNID_PAIR (FILE *f, TXNID_PAIR *txnid, struct x1764 *checksum, uint32_t *len) { TXNID parent; TXNID child; - toku_fread_TXNID(f, &parent, checksum, len); - toku_fread_TXNID(f, &child, checksum, len); + int r; + r = toku_fread_TXNID(f, &parent, checksum, len); if (r != 0) { return r; } + r = toku_fread_TXNID(f, &child, checksum, len); if (r != 0) { return r; } txnid->parent_id64 = parent; txnid->child_id64 = child; return 0; diff --git a/portability/tests/CMakeLists.txt b/portability/tests/CMakeLists.txt index 4c711f136d8..7fea21fc8e3 100644 --- a/portability/tests/CMakeLists.txt +++ b/portability/tests/CMakeLists.txt @@ -8,16 +8,6 @@ if(BUILD_TESTING) file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.cc) - include(CheckCCompilerFlag) - check_c_compiler_flag(-Wno-unused-result HAVE_WNO_UNUSED_RESULT) - if (HAVE_WNO_UNUSED_RESULT) - add_space_separated_property(SOURCE try-leak-lost COMPILE_FLAGS -Wno-unused-result) - endif () - check_c_compiler_flag(-Wno-maybe-uninitialized HAVE_WNO_MAYBE_UNINITIALIZED) - if (HAVE_WNO_MAYBE_UNINITIALIZED) - add_space_separated_property(SOURCE try-uninit COMPILE_FLAGS -Wno-maybe-uninitialized) - endif () - foreach(src ${srcs}) get_filename_component(test ${src} NAME_WE) add_executable(${test} ${test}) @@ -27,6 +17,17 @@ if(BUILD_TESTING) list(APPEND tests ${test}) endforeach(src) + include(CheckCCompilerFlag) + check_c_compiler_flag(-Wno-unused-result HAVE_WNO_UNUSED_RESULT) + if (HAVE_WNO_UNUSED_RESULT) + add_space_separated_property(SOURCE try-leak-lost COMPILE_FLAGS -Wno-unused-result) + endif () + check_c_compiler_flag(-Wno-maybe-uninitialized HAVE_WNO_MAYBE_UNINITIALIZED) + if (HAVE_WNO_MAYBE_UNINITIALIZED) + add_space_separated_property(SOURCE try-uninit COMPILE_FLAGS -Wno-maybe-uninitialized) + add_space_separated_property(TARGET try-uninit LINK_FLAGS -Wno-maybe-uninitialized) + endif () + configure_file(ensure_memcheck_fails.sh . COPYONLY) foreach(test try-leak-lost try-leak-reachable try-uninit) list(REMOVE_ITEM tests ${test}) diff --git a/src/tests/test_cursor_stickyness.cc b/src/tests/test_cursor_stickyness.cc index baa08c8bffa..57ff51eabba 100644 --- a/src/tests/test_cursor_stickyness.cc +++ b/src/tests/test_cursor_stickyness.cc @@ -151,6 +151,9 @@ test_cursor_sticky (int n, int dup_mode) { DBC *cursor; r = db->cursor(db, 0, &cursor, 0); assert(r == 0); for (i=0; i= nest_level) { //start new subtree int max = nest_level + 4; - if (MAX_NEST - 1 < max) max = MAX_NEST - 1; - assert(max > nest_level); + if (MAX_NEST - 1 < max) { + max = MAX_NEST - 1; + assert(max > nest_level); + } int branch_level; for (branch_level = nest_level + 1; branch_level <= max; branch_level++) { start_txn_and_maybe_insert_or_delete(branch_level); diff --git a/src/tests/test_txn_nested5.cc b/src/tests/test_txn_nested5.cc index 618c0abf6cc..8aef5ec107a 100644 --- a/src/tests/test_txn_nested5.cc +++ b/src/tests/test_txn_nested5.cc @@ -377,8 +377,10 @@ futz_with_stack: if (min_allowed_branch_level >= nest_level) { //start new subtree int max = nest_level + 4; - if (MAX_NEST - 1 < max) max = MAX_NEST - 1; - assert(max > nest_level); + if (MAX_NEST - 1 < max) { + max = MAX_NEST - 1; + assert(max > nest_level); + } int branch_level; for (branch_level = nest_level + 1; branch_level <= max; branch_level++) { start_txn_and_maybe_insert_or_delete(branch_level);