Commit ca9e0089 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-19740: Fix GCC 9.2.1 -Wmaybe-uninitialized on AMD64

For CMAKE_BUILD_TYPE=Debug, the default MYSQL_MAINTAINER_MODE=AUTO
implies -Werror along with other flags in cmake/maintainer.cmake,
which would break the debug builds when CMAKE_CXX_FLAGS include -O2.

This fix includes a backport of 6dd3f240
from MariaDB 10.3.
parent 2d6719d7
......@@ -428,11 +428,9 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
TABLE *table= field->table;
sql_mode_t orig_sql_mode= thd->variables.sql_mode;
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
my_bitmap_map *old_maps[2];
my_bitmap_map *old_maps[2] = { NULL, NULL };
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
LINT_INIT_STRUCT(old_maps);
/* table->read_set may not be set if we come here from a CREATE TABLE */
if (table && table->read_set)
dbug_tmp_use_all_columns(table, old_maps,
......
/*
Copyright (c) 2010, 2015, MariaDB
Copyright (c) 2010, 2019, 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
......@@ -92,17 +92,13 @@ class Loose_scan_opt
public:
Loose_scan_opt():
try_loosescan(FALSE),
try_loosescan(false),
bound_sj_equalities(0),
quick_uses_applicable_index(FALSE)
quick_uses_applicable_index(FALSE), quick_max_loose_keypart(0),
best_loose_scan_key(0), best_loose_scan_records(0.0),
best_loose_scan_start_key(NULL),
best_max_loose_keypart(0), best_ref_depend_map(0)
{
/* Protected by quick_uses_applicable_index */
LINT_INIT(quick_max_loose_keypart);
/* The following are protected by best_loose_scan_cost!= DBL_MAX */
LINT_INIT(best_loose_scan_key);
LINT_INIT(best_loose_scan_records);
LINT_INIT(best_max_loose_keypart);
LINT_INIT(best_loose_scan_start_key);
}
void init(JOIN *join, JOIN_TAB *s, table_map remaining_tables)
......
......@@ -1814,16 +1814,13 @@ class Index_prefix_calc: public Sql_alloc
bool is_partial_fields_present;
Index_prefix_calc(THD *thd, TABLE *table, KEY *key_info)
: index_table(table), index_info(key_info)
: index_table(table), index_info(key_info), prefixes(0), empty(true),
calc_state(NULL), is_single_comp_pk(false), is_partial_fields_present(false)
{
uint i;
Prefix_calc_state *state;
uint key_parts= table->actual_n_key_parts(key_info);
empty= TRUE;
prefixes= 0;
LINT_INIT_STRUCT(calc_state);
is_partial_fields_present= is_single_comp_pk= FALSE;
uint pk= table->s->primary_key;
if ((uint) (table->key_info - key_info) == pk &&
table->key_info[pk].user_defined_key_parts == 1)
......
......@@ -83,13 +83,13 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error
#endif
DBUG_ENTER("walk_and_match");
LINT_INIT_STRUCT(subkeys);
word->weight=LWS_FOR_QUERY;
_ma_ft_make_key(info, &key, aio->keynr, keybuff, word, 0);
key.data_length-= HA_FT_WLEN;
doc_cnt=0;
subkeys.i= 0;
if (share->lock_key_trees)
mysql_rwlock_rdlock(&share->keyinfo[aio->keynr].root_lock);
......
......@@ -81,13 +81,13 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error
#endif
DBUG_ENTER("walk_and_match");
LINT_INIT_STRUCT(subkeys);
word->weight=LWS_FOR_QUERY;
keylen=_ft_make_key(info,aio->keynr,keybuff,word,0);
keylen-=HA_FT_WLEN;
doc_cnt=0;
subkeys.i= 0;
if (share->concurrent_insert)
mysql_rwlock_rdlock(&share->key_root_lock[aio->keynr]);
......
......@@ -47,7 +47,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr;
char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr;
char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
enum en_fieldtype type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment