Bug #71624 printf size_t results in a fatal warning in 32-bit debug builds
Description:
5.6.16 fails to build with -DWITH_DEBUG=ON because:
on Ubuntu Quantal, 32 bits:
/home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/ubuntu-quantal-32bit/storage/innobase/fil/fil0fil.cc: In function ‘bool fil_user_tablespace_find_space_id(fsp_open_info*)’:
/home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/ubuntu-quantal-32bit/storage/innobase/fil/fil0fil.cc:4106:41: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘std::map<long unsigned int, long unsigned int>::size_type {aka unsigned int}’ [-Werror=format]
on CentOS 6, 32 bits
cc1plus: warnings being treated as errors
/home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/centos6-32/storage/innobase/fil/fil0fil.cc: In function 'bool fil_user_tablespace_find_space_id(fsp_open_info*)':
/home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/centos6-32/storage/innobase/fil/fil0fil.cc:4106: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'size_t'
make[2]: *** [storage/innobase/CMakeFiles/innobase.dir/fil/fil0fil.cc.o] Error 1
Code in question is
ib_logf(IB_LOG_LEVEL_INFO, "Page size: %lu, Possible space_id "
"count:%lu", page_size, verify.size());
"%lu" is not a portable way to print size_t.
Regression introduced in rev 5703.
How to repeat:
Configure an build on a 32 bit host with -DWITH_DEBUG=ON.
Suggested fix:
AFAIK there is no portable printf format specifier for size_t. One has to cast size_t to something wide, e.g. ib_uint64_t and use UINT64PF.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: 5.6.16 fails to build with -DWITH_DEBUG=ON because: on Ubuntu Quantal, 32 bits: /home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/ubuntu-quantal-32bit/storage/innobase/fil/fil0fil.cc: In function ‘bool fil_user_tablespace_find_space_id(fsp_open_info*)’: /home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/ubuntu-quantal-32bit/storage/innobase/fil/fil0fil.cc:4106:41: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘std::map<long unsigned int, long unsigned int>::size_type {aka unsigned int}’ [-Werror=format] on CentOS 6, 32 bits cc1plus: warnings being treated as errors /home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/centos6-32/storage/innobase/fil/fil0fil.cc: In function 'bool fil_user_tablespace_find_space_id(fsp_open_info*)': /home/jenkins/workspace/mysql-5.6-trunk/BUILD_TYPE/debug/Host/centos6-32/storage/innobase/fil/fil0fil.cc:4106: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'size_t' make[2]: *** [storage/innobase/CMakeFiles/innobase.dir/fil/fil0fil.cc.o] Error 1 Code in question is ib_logf(IB_LOG_LEVEL_INFO, "Page size: %lu, Possible space_id " "count:%lu", page_size, verify.size()); "%lu" is not a portable way to print size_t. Regression introduced in rev 5703. How to repeat: Configure an build on a 32 bit host with -DWITH_DEBUG=ON. Suggested fix: AFAIK there is no portable printf format specifier for size_t. One has to cast size_t to something wide, e.g. ib_uint64_t and use UINT64PF.