[MDEV-28301] Spider: Fix GCC warnings, comparing the result of pointer addition ... and NULL Created: 2022-04-12  Updated: 2022-05-23  Resolved: 2022-05-13

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3, 10.9.1

Type: Bug Priority: Major
Reporter: Nayuta Yanagisawa (Inactive) Assignee: Nayuta Yanagisawa (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 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.



 Comments   
Comment by Nayuta Yanagisawa (Inactive) [ 2022-04-18 ]

holyfoot Please review https://github.com/MariaDB/server/commit/a045c8c58d268039cd3a83fd4f542fefcab56c21

Comment by Alexey Botchkov [ 2022-05-13 ]

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

Comment by Nayuta Yanagisawa (Inactive) [ 2022-05-13 ]

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

Generated at Thu Feb 08 09:59:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.