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

compilation failure on centos74-amd64-debug

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 10.5
    • 10.5.4
    • Compiling
    • None

    Description

      /home/buildbot/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/mariadb-10.5.4/storage/innobase/include/univ.i:553:35: error: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Werror=conversion]
       #define UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0]))
                                         ^
      /home/buildbot/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/mariadb-10.5.4/storage/innobase/ut/ut0new.cc:250:56: note: in expansion of macro ‘UT_ARR_SIZE’
         PSI_MEMORY_CALL(register_memory)("innodb", pfs_info, UT_ARR_SIZE(pfs_info));
                                                              ^
      

      Attachments

        Issue Links

          Activity

            marko Marko Mäkelä added a comment - - edited

            I cannot repeat this with GCC 8.4.0 or GCC 9.3.0.

            GCC 8.4.0 issued a different, totally bogus-looking warning to me:

            10.5 d6af055c556a8b2f068c84e73d11fe461b3ad3f3

            [4/100] Building CXX object storage/innobase/CMakeFiles/innobase.dir/fsp/fsp0space.cc.o
            In file included from /mariadb/10.5m/storage/innobase/include/mem0mem.h:345,
                             from /mariadb/10.5m/storage/innobase/include/fsp0file.h:30,
                             from /mariadb/10.5m/storage/innobase/include/fsp0space.h:30,
                             from /mariadb/10.5m/storage/innobase/include/fsp0sysspace.h:29,
                             from /mariadb/10.5m/storage/innobase/fsp/fsp0space.cc:27:
            In function ‘char* mem_strdupl(const char*, ulint)’,
                inlined from ‘void Tablespace::set_path(const char*, size_t)’ at /mariadb/10.5m/storage/innobase/include/fsp0space.h:91:23,
                inlined from ‘dberr_t Tablespace::add_datafile(const char*)’ at /mariadb/10.5m/storage/innobase/fsp/fsp0space.cc:217:11:
            /mariadb/10.5m/storage/innobase/include/mem0mem.ic:465:34: warning: ‘void* memcpy(void*, const void*, size_t)’ pointer overflow between offset 0 and size [-1, 9223372036854775807] [-Warray-bounds]
              return(static_cast<char*>(memcpy(s, str, len)));
                                        ~~~~~~^~~~~~~~~~~~~
            

            The code in question did check for overflow. (The patch is a no-op, just to highlight where the code was expanded.)

            diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc
            index 1ed4af86367..4bf4bf97760 100644
            --- a/storage/innobase/fsp/fsp0space.cc
            +++ b/storage/innobase/fsp/fsp0space.cc
            @@ -213,7 +213,7 @@ Tablespace::add_datafile(
             	/* If the pathname contains a directory separator, fill the
             	m_path member which is the default directory for files in this
             	tablespace. Leave it null otherwise. */
            -	if (dirlen > 0) {
            +	if (dirlen) {
             		set_path(filepath, dirlen);
             	}
             
            

            The problem appears to be a mismatch with the PERFORMANCE_SCHEMA ABI:

            typedef void (*register_memory_v1_t)
              (const char *category, struct PSI_memory_info_v1 *info, int count);
            

            Why, oh why, int instead of size_t?

            marko Marko Mäkelä added a comment - - edited I cannot repeat this with GCC 8.4.0 or GCC 9.3.0. GCC 8.4.0 issued a different, totally bogus-looking warning to me: 10.5 d6af055c556a8b2f068c84e73d11fe461b3ad3f3 [4/100] Building CXX object storage/innobase/CMakeFiles/innobase.dir/fsp/fsp0space.cc.o In file included from /mariadb/10.5m/storage/innobase/include/mem0mem.h:345, from /mariadb/10.5m/storage/innobase/include/fsp0file.h:30, from /mariadb/10.5m/storage/innobase/include/fsp0space.h:30, from /mariadb/10.5m/storage/innobase/include/fsp0sysspace.h:29, from /mariadb/10.5m/storage/innobase/fsp/fsp0space.cc:27: In function ‘char* mem_strdupl(const char*, ulint)’, inlined from ‘void Tablespace::set_path(const char*, size_t)’ at /mariadb/10.5m/storage/innobase/include/fsp0space.h:91:23, inlined from ‘dberr_t Tablespace::add_datafile(const char*)’ at /mariadb/10.5m/storage/innobase/fsp/fsp0space.cc:217:11: /mariadb/10.5m/storage/innobase/include/mem0mem.ic:465:34: warning: ‘void* memcpy(void*, const void*, size_t)’ pointer overflow between offset 0 and size [-1, 9223372036854775807] [-Warray-bounds] return(static_cast<char*>(memcpy(s, str, len))); ~~~~~~^~~~~~~~~~~~~ The code in question did check for overflow. (The patch is a no-op, just to highlight where the code was expanded.) diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index 1ed4af86367..4bf4bf97760 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -213,7 +213,7 @@ Tablespace::add_datafile( /* If the pathname contains a directory separator, fill the m_path member which is the default directory for files in this tablespace. Leave it null otherwise. */ - if (dirlen > 0) { + if (dirlen) { set_path(filepath, dirlen); } The problem appears to be a mismatch with the PERFORMANCE_SCHEMA ABI: typedef void (*register_memory_v1_t) ( const char *category, struct PSI_memory_info_v1 *info, int count); Why, oh why, int instead of size_t ?

            This was affecting bld-p9-rhel7 as well. And that builder is fixed now. The -Wconversion in GCC 4.8.5 would apparently complain about the sign mismatch between int and size_t.

            marko Marko Mäkelä added a comment - This was affecting bld-p9-rhel7 as well. And that builder is fixed now. The -Wconversion in GCC 4.8.5 would apparently complain about the sign mismatch between int and size_t .

            People

              marko Marko Mäkelä
              serg Sergei Golubchik
              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.