summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-23 12:27:56 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-23 12:27:56 +0300
commitaf40a2b43e94cab6b25c9efe4b18c3112b4a9e6c (patch)
treea34a0afceb3e55d3f7c434eee457a86daa663eb5
parent0448558a0dd88c8031b66a9ea0296ee05b6333d3 (diff)
downloadmariadb-git-af40a2b43e94cab6b25c9efe4b18c3112b4a9e6c.tar.gz
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.
-rw-r--r--sql/item_geofunc.cc16
-rw-r--r--sql/opt_subselect.cc13
-rw-r--r--storage/innobase/btr/btr0sea.cc6
3 files changed, 14 insertions, 21 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 0db8d7075f6..1c3fafc0582 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1,5 +1,5 @@
/* 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
it under the terms of the GNU General Public License as published by
@@ -456,16 +456,18 @@ String *Item_func_boundary::val_str(String *str_value)
DBUG_ASSERT(fixed == 1);
String arg_val;
String *swkb= args[0]->val_str(&arg_val);
+
+ if ((null_value= args[0]->null_value))
+ DBUG_RETURN(0);
+
Geometry_buffer buffer;
- Geometry *g;
uint32 srid= 0;
Transporter trn(&res_receiver);
-
- if ((null_value=
- args[0]->null_value ||
- !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))
+
+ Geometry *g= Geometry::construct(&buffer, swkb->ptr(), swkb->length());
+ if (!g)
DBUG_RETURN(0);
-
+
if (g->store_shapes(&trn))
goto mem_error;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 45aa625389d..fec4e8b2828 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -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
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
{
uint key= keyuse->key;
- KEY *keyinfo;
key_part_map bound_parts= 0;
- bool is_excluded_key= keyuse->is_for_hash_join();
- if (!is_excluded_key)
- {
- keyinfo= table->key_info + key;
- is_excluded_key= !MY_TEST(keyinfo->flags & HA_NOSAME);
- }
- if (!is_excluded_key)
+ if (!keyuse->is_for_hash_join() &&
+ (table->key_info[key].flags & HA_NOSAME))
{
+ KEY *keyinfo= table->key_info + key;
do /* For all equalities on all key parts */
{
/*
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index ea34b4034e4..ee39aacf162 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1731,7 +1731,6 @@ func_exit:
void
btr_search_update_hash_on_insert(btr_cur_t* cursor)
{
- hash_table_t* table;
buf_block_t* block;
dict_index_t* index;
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);
+ hash_table_t* const table = btr_get_search_table(index);
bool locked = false;
if (!page_rec_is_infimum(rec)) {
@@ -1814,7 +1814,6 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
goto function_exit;
}
- table = btr_get_search_table(index);
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) {
goto function_exit;
}
- table = btr_get_search_table(index);
}
if (!left_side) {
@@ -1851,7 +1849,6 @@ check_next_rec:
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
- table = btr_get_search_table(index);
}
ha_insert_for_fold(table, ins_fold, block, ins_rec);
@@ -1868,7 +1865,6 @@ check_next_rec:
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
- table = btr_get_search_table(index);
}
if (!left_side) {