Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-760

LP #1277505: printf size_t results in a fatal warning in 32-bit debug builds

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      **Reported in Launchpad by Laurynas Biveinis last update 27-02-2014 12:31:43

      http://bugs.mysql.com/bug.php?id=71624:

      [7 Feb 13:12] Laurynas Biveinis

      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.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lpjirasync lpjirasync (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Smart Checklist