Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4.1
-
None
Description
marko reports
gcc 8 -O2 seems to indicate a real error for this code: |
table_opened= true; |
table= tlist.table;
|
|
if ((err= gtid_check_rpl_slave_state_table(table))) |
goto end; |
|
direct_pos= table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION;
|
the warning:
/mariadb/10.4/sql/rpl_gtid.cc:980:7: warning: 'direct_pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!direct_pos)
^~
that code in question is after end:, and inside if (table_opened) (which has been initialized above, but direct_pos is not if we do the above goto end)
The following patch should suffice:
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
|
index 17f474c2acf..ab74ab74687 100644 |
--- a/sql/rpl_gtid.cc
|
+++ b/sql/rpl_gtid.cc
|
@@ -904,9 +904,6 @@ rpl_slave_state::gtid_delete_pending(THD *thd, |
table_opened= true; |
table= tlist.table;
|
|
- if ((err= gtid_check_rpl_slave_state_table(table))) |
- goto end; |
-
|
direct_pos= table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION;
|
bitmap_set_all(table->write_set);
|
table->rpl_write_set= table->write_set;
|
@@ -921,6 +918,9 @@ rpl_slave_state::gtid_delete_pending(THD *thd, |
goto end; |
}
|
|
+ if ((err= gtid_check_rpl_slave_state_table(table))) |
+ goto end; |
+
|
cur = *list_ptr;
|
cur_ptr_ptr = list_ptr;
|
do |
as there's no urgency to call gtid_check_rpl_slave_state_table() earlier than the var-in-question gets assigned.