Skip to content
Permalink
Browse files

Silence GCC 9.2.1 -Warray-bounds

No memory access violated the bounds of fake_extra_buf[],
but GCC does not like the fact that the pointer fake_extra
ends up pointing before the array.
Allocate a dummy element at the start of fake_extra_buf[]
in order to silence the warning.
  • Loading branch information...
dr-m committed Aug 16, 2019
1 parent d50fe40 commit 130d9490c844d82a7a8613c343a1969c0bec4c62
Showing with 4 additions and 4 deletions.
  1. +4 −4 storage/innobase/row/row0log.cc
@@ -1003,7 +1003,7 @@ row_log_table_low(
extra_size = rec_extra_size + is_instant;

unsigned fake_extra_size = 0;
byte fake_extra_buf[2];
byte fake_extra_buf[3];
if (is_instant && UNIV_UNLIKELY(!index->is_instant())) {
/* The source table was emptied after ALTER TABLE
started, and it was converted to non-instant format.
@@ -1015,9 +1015,9 @@ row_log_table_low(
fake_extra_size = rec_get_n_add_field_len(n_add);
ut_ad(fake_extra_size == 1 || fake_extra_size == 2);
extra_size += fake_extra_size;
byte* fake_extra = fake_extra_buf + fake_extra_size - 1;
byte* fake_extra = fake_extra_buf + fake_extra_size;
rec_set_n_add_field(fake_extra, n_add);
ut_ad(fake_extra + 1 == fake_extra_buf);
ut_ad(fake_extra == fake_extra_buf);
}

mrec_size = ROW_LOG_HEADER_SIZE
@@ -1076,7 +1076,7 @@ row_log_table_low(

memcpy(b, rec - rec_extra_size - omit_size, rec_extra_size);
b += rec_extra_size;
memcpy(b, fake_extra_buf, fake_extra_size);
memcpy(b, fake_extra_buf + 1, fake_extra_size);
b += fake_extra_size;
ulint len;
ulint trx_id_offs = rec_get_nth_field_offs(

0 comments on commit 130d949

Please sign in to comment.
You can’t perform that action at this time.