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

Spider: Fix GCC warnings, comparing the result of pointer addition ... and NULL

Details

    Description

      GCC 12 says:

      /mariadb/10.9/storage/spider/spd_db_mysql.cc: In member function 'virtual int spider_db_mbase::append_lock_tables(spider_string*)':
      /mariadb/10.9/storage/spider/spd_db_mysql.cc:3722:9: error: comparing the result of pointer addition '(db_share->spider_mbase_share::db_names_str + ((sizetype)(conn_link_idx * 52)))' and NULL [-Werror=address]
       3722 |     if (&db_share->db_names_str[conn_link_idx])
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /mariadb/10.9/storage/spider/spd_db_mysql.cc:3732:9: error: comparing the result of pointer addition '(db_share->spider_mbase_share::table_names_str + ((sizetype)(conn_link_idx * 52)))' and NULL [-Werror=address]
       3732 |     if (&db_share->table_names_str[conn_link_idx])
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

      The current affect (or fix) version, 10.9, might not be correct. Check the older versions too.

      Attachments

        Activity

          nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - holyfoot Please review https://github.com/MariaDB/server/commit/a045c8c58d268039cd3a83fd4f542fefcab56c21

          ok to push.
          I'd like to note though that spd_db_oracle.cc and spd_db_odbc.cc also have that weird code.
          ok to push fixes there in advance if you plan to

          holyfoot Alexey Botchkov added a comment - ok to push. I'd like to note though that spd_db_oracle.cc and spd_db_odbc.cc also have that weird code. ok to push fixes there in advance if you plan to

          Thank you for pointing this out. I will for spd_db_odbc.cc too.

          nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - Thank you for pointing this out. I will for spd_db_odbc.cc too.

          People

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
            nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.