Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-9988

Insert cast to suppress -Wdynamic-class-memaccess

    XMLWordPrintable

    Details

    • 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,
      

        Attachments

          Activity

            People

            Assignee:
            svoj Sergey Vojtovich
            Reporter:
            davidgow David Gow
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: