mysql / mysql/mysql-server

Compiler warnings in In constructor ‘Log_event::Log_event(...)

Open
#706 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
12.4k
Forks
4.4k
Avg merge
8d 16h
Merged PRs (30d)
1

Description

MySQL version / commit

26.7

Steps to reproduce

Compiling MySQL 26.7.0 produces these warnings - maybe, the compiler doesn't see the correct path, but this shouldn't happen:

In constructor ‘Log_event::Log_event(mysql::binlog::event::Log_event_header*, mysql::binlog::event::Log_event_footer*)’,
    inlined from ‘Rows_log_event::Rows_log_event(const char*, const mysql::binlog::event::Format_description_event*)’ at /builds/mysql-server-trunk-26.7.0./sql/log_event.cc:7858:25:
/builds/mysql-server-trunk-26.7.0./sql/log_event.cc:973:30: warning: ‘((mysql::binlog::event::Log_event_header*)this)[7].mysql::binlog::event::Log_event_header::unmasked_server_id’ is used uninitialized [-Wuninitialized]
  973 |   server_id = common_header->unmasked_server_id & opt_server_id_mask;
      |               ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /builds/mysql-server-trunk-26.7.0./sql/log_event.h:56,
                 from /builds/mysql-server-trunk-26.7.0./sql/log_event.cc:27:
In member function ‘bool mysql::binlog::event::Log_event_header::get_is_valid()’,
    inlined from ‘bool Log_event::is_valid()’ at /builds/mysql-server-trunk-26.7.0./sql/log_event.cc:1312:65,
    inlined from ‘Rows_log_event::Rows_log_event(const char*, const mysql::binlog::event::Format_description_event*)’ at /builds/mysql-server-trunk-26.7.0./sql/log_event.cc:7870:16:
/builds/mysql-server-trunk-26.7.0./libs/mysql/binlog/event/binlog_event.h:750:32: warning: ‘((mysql::binlog::event::Log_event_header*)this)[7].mysql::binlog::event::Log_event_header::m_is_valid’ is used uninitialized [-Wuninitialized]
  750 |   bool get_is_valid() { return m_is_valid; }
      |                                ^~~~~~~~~~
/builds/mysql-server-trunk-26.7.0./sql/log_event.cc: In constructor ‘Rows_log_event::Rows_log_event(const char*, const mysql::binlog::event::Format_description_event*)’:
/builds/mysql-server-trunk-26.7.0./sql/log_event.cc:7895:27: warning: ‘((mysql::binlog::event::Rows_event*)((char*)this + 64))[1].mysql::binlog::event::Rows_event::m_width’ may be used uninitialized [-Wmaybe-uninitialized]
 7895 |                           m_width))) {
      |                           ^~~~~~~
Expected vs actual result

No warnings.

Platform / compiler

SLES 15.7, gcc 15

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported MySQL 26.7.0 build with GCC 15 on SLES 15.7, then inspect the Rows_log_event constructor in sql/log_event.cc and the related declarations in sql/log_event.h and libs/mysql/binlog/event/binlog_event.h. Trace the reported uninitialized values in Log_event_header and Rows_event; done means the build no longer emits these warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.