Skip to content

Commit

Permalink
MDEV-19740: Fix GCC 9.2.1 -Wmaybe-uninitialized on AMD64
Browse files Browse the repository at this point in the history
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 6dd3f24
from MariaDB 10.3.
  • Loading branch information
dr-m committed Sep 27, 2019
1 parent 2d6719d commit ca9e008
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
4 changes: 1 addition & 3 deletions sql/item_cmpfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 7 additions & 11 deletions sql/opt_subselect.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
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
Expand Down Expand Up @@ -92,19 +92,15 @@ 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)
{
/*
Expand Down
7 changes: 2 additions & 5 deletions sql/sql_statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_ft_nlq_search.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion storage/myisam/ft_nlq_search.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion storage/myisam/mi_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ca9e008

Please sign in to comment.