[MDEV-17542] 10.3: gcc-8.0 produces lots of -Wclass-memaccess warnings in Table_scope_and_contents_source_st Created: 2018-10-25  Updated: 2018-10-25  Resolved: 2018-10-25

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.3.11, 10.4.0

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   
  • Note: the problem is repeatable with 10.2 and earlier versions as well. But in 10.2 and earlier we don't have Vers_parse_info, so it can be fixed by a simpler (but not future proof) patch, e.g. casting "this" to void*. Using cast to void is dangerous though, so it should be avoided in 10.3+.
  • Note: 10.2 and earlier versions will be fixed under terms of a separate MDEV

gcc-8.0 has a new warning when a class or struct with a constructor is bzero'd.

A lot of warnings if this kind are generated by this method:

struct Table_scope_and_contents_source_st
..
  void init()
  {
    bzero(this, sizeof(*this));
  }
..

This structure has non-trivial members:

  • SQL_I_List<TABLE_LIST> merge_list;
  • Vers_parse_info vers_info;

which have constructors.

So bzero'ing is not indeed logically correct. Moveover, the constructor of SQL_I_LIST does more than just bzero.

This should be fixed.


Generated at Thu Feb 08 08:37:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.