[MDEV-9988] Insert cast to suppress -Wdynamic-class-memaccess Created: 2016-04-26  Updated: 2016-06-29  Resolved: 2016-04-28

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.0.24
Fix Version/s: 10.0.25, 10.1.14

Type: Bug Priority: Minor
Reporter: David Gow Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: contribution, foundation
Environment:

Ubuntu clang version 3.6.0-2ubuntu1~trusty1 with -Wdynamic-class-memaccess


Attachments: File 0001-Insert-cast-to-suppress-Wdynamic-class-memaccess.patch    
Sprint: 10.1.14

 Description   

The clang -Wdynamic-class-memaccess warning is triggered when a Duplicate_weedout_picker's vtable is overwritten with memcpy or memset

mariadb-server/sql/sql_select.cc:24654:10: warning: destination for this 'memset' call is a pointer to class containing a dynamic class 'Duplicate_weedout_picker'; vtable pointer will be overwritten
      [-Wdynamic-class-memaccess]
  memset(best_positions, 0, sizeof(POSITION) * (table_count + 1));
mariadb-server/sql/sql_select.cc:24654:10: note: explicitly cast the pointer to silence this warning
  memset(best_positions, 0, sizeof(POSITION) * (table_count + 1));
mariadb-server/sql/opt_subselect.cc:2246:21: warning: destination for this 'memcpy' call is a pointer to class containing a dynamic class 'Duplicate_weedout_picker'; vtable pointer will be overwritten
      [-Wdynamic-class-memaccess]
        memcpy(sjm->positions, join->best_positions + join->const_tables, 
mariadb-server/sql/opt_subselect.cc:2246:21: note: explicitly cast the pointer to silence this warning
        memcpy(sjm->positions, join->best_positions + join->const_tables, 
mariadb-server/sql/opt_subselect.cc:3350:32: warning: destination for this 'memcpy' call is a pointer to class containing a dynamic class 'Duplicate_weedout_picker'; vtable pointer will be overwritten
      [-Wdynamic-class-memaccess]
      memcpy(pos - sjm->tables + 1, sjm->positions, 
mariadb-server/sql/opt_subselect.cc:3350:32: note: explicitly cast the pointer to silence this warning
      memcpy(pos - sjm->tables + 1, sjm->positions, 
mariadb-server/sql/opt_subselect.cc:3366:35: warning: destination for this 'memcpy' call is a pointer to class containing a dynamic class 'Duplicate_weedout_picker'; vtable pointer will be overwritten
      [-Wdynamic-class-memaccess]
      memcpy(join->best_positions + first, 
mariadb-server/sql/opt_subselect.cc:3366:35: note: explicitly cast the pointer to silence this warning
      memcpy(join->best_positions + first,



 Comments   
Comment by Sergey Vojtovich [ 2016-04-28 ]

Thanks for your contribution! Pushed: https://github.com/MariaDB/server/commit/94bad73dd1dd563a3a324dcd519975f6d995dc88

Generated at Thu Feb 08 07:38:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.