Fix GCC 10.2.0 -Og -fsanitize=undefined -Wmaybe-uninitialized

For some reason, adding -fsanitize=undefined (cmake -DWITH_UBSAN=ON)
to the compilation flags will cause even more warnings to be emitted.
The warnings do look bogus, but the code can be simplified.
This commit is contained in:
Marko Mäkelä 2020-09-23 12:27:56 +03:00
parent 0448558a0d
commit af40a2b43e
3 changed files with 14 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates. /* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB Copyright (c) 2011, 2020, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -456,14 +456,16 @@ String *Item_func_boundary::val_str(String *str_value)
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String arg_val; String arg_val;
String *swkb= args[0]->val_str(&arg_val); String *swkb= args[0]->val_str(&arg_val);
if ((null_value= args[0]->null_value))
DBUG_RETURN(0);
Geometry_buffer buffer; Geometry_buffer buffer;
Geometry *g;
uint32 srid= 0; uint32 srid= 0;
Transporter trn(&res_receiver); Transporter trn(&res_receiver);
if ((null_value= Geometry *g= Geometry::construct(&buffer, swkb->ptr(), swkb->length());
args[0]->null_value || if (!g)
!(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))
DBUG_RETURN(0); DBUG_RETURN(0);
if (g->store_shapes(&trn)) if (g->store_shapes(&trn))

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2010, 2019, MariaDB Copyright (c) 2010, 2020, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -2634,16 +2634,11 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables)
do do
{ {
uint key= keyuse->key; uint key= keyuse->key;
KEY *keyinfo;
key_part_map bound_parts= 0; key_part_map bound_parts= 0;
bool is_excluded_key= keyuse->is_for_hash_join(); if (!keyuse->is_for_hash_join() &&
if (!is_excluded_key) (table->key_info[key].flags & HA_NOSAME))
{
keyinfo= table->key_info + key;
is_excluded_key= !MY_TEST(keyinfo->flags & HA_NOSAME);
}
if (!is_excluded_key)
{ {
KEY *keyinfo= table->key_info + key;
do /* For all equalities on all key parts */ do /* For all equalities on all key parts */
{ {
/* /*

View File

@ -1731,7 +1731,6 @@ func_exit:
void void
btr_search_update_hash_on_insert(btr_cur_t* cursor) btr_search_update_hash_on_insert(btr_cur_t* cursor)
{ {
hash_table_t* table;
buf_block_t* block; buf_block_t* block;
dict_index_t* index; dict_index_t* index;
const rec_t* rec; const rec_t* rec;
@ -1798,6 +1797,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
} }
rw_lock_t* const latch = btr_get_search_latch(index); rw_lock_t* const latch = btr_get_search_latch(index);
hash_table_t* const table = btr_get_search_table(index);
bool locked = false; bool locked = false;
if (!page_rec_is_infimum(rec)) { if (!page_rec_is_infimum(rec)) {
@ -1814,7 +1814,6 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
goto function_exit; goto function_exit;
} }
table = btr_get_search_table(index);
ha_insert_for_fold(table, ins_fold, block, ins_rec); ha_insert_for_fold(table, ins_fold, block, ins_rec);
} }
@ -1830,7 +1829,6 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
if (!btr_search_enabled || !block->index) { if (!btr_search_enabled || !block->index) {
goto function_exit; goto function_exit;
} }
table = btr_get_search_table(index);
} }
if (!left_side) { if (!left_side) {
@ -1851,7 +1849,6 @@ check_next_rec:
if (!btr_search_enabled || !block->index) { if (!btr_search_enabled || !block->index) {
goto function_exit; goto function_exit;
} }
table = btr_get_search_table(index);
} }
ha_insert_for_fold(table, ins_fold, block, ins_rec); ha_insert_for_fold(table, ins_fold, block, ins_rec);
@ -1868,7 +1865,6 @@ check_next_rec:
if (!btr_search_enabled || !block->index) { if (!btr_search_enabled || !block->index) {
goto function_exit; goto function_exit;
} }
table = btr_get_search_table(index);
} }
if (!left_side) { if (!left_side) {