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

Compilation warning "'<anonymous>' may be used uninitialized" in RecordCallback constructor with GCC

    XMLWordPrintable

Details

    • Q3/2026 Server Development

    Description

      Building InnoDB with GCC at -O1 or above produces a -Wmaybe-uninitialized
      warning for every RecordCallback subclass that is constructed with a
      captureless lambda as its comparator:

      [2/25] Building CXX object storage/innobase/CMakeFiles/innobase.dir/fts/fts0exec.cc.o
      In file included from /usr/include/c++/13/functional:59,
                       from /home/thiru/source_code/main_work/storage/innobase/include/row0query.h:29,
                       from /home/thiru/source_code/main_work/storage/innobase/include/fts0exec.h:28,
                       from /home/thiru/source_code/main_work/storage/innobase/fts/fts0exec.cc:23:
      In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = RecordCompareAction; _ArgTypes = {const dtuple_t*, const unsigned char*, const dict_index_t*, const short unsigned int*}]’,
          inlined from ‘RecordCallback::RecordCallback(RecordProcessor, RecordComparator)’ at /home/thiru/source_code/main_work/storage/innobase/include/row0query.h:80:34,
          inlined from ‘CommonTableReader::CommonTableReader()’ at /home/thiru/source_code/main_work/storage/innobase/fts/fts0exec.cc:676:53:
      /usr/include/c++/13/bits/std_function.h:391:17: warning: ‘<anonymous>’ may be used uninitialized [-Wmaybe-uninitialized]
        391 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
            |             ~~~~^~~~~~~~~~
      /usr/include/c++/13/bits/std_function.h: In constructor ‘CommonTableReader::CommonTableReader()’:
      /usr/include/c++/13/bits/std_function.h:267:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = RecordCompareAction; _Functor = CommonTableReader::CommonTableReader()::<lambda(const dtuple_t*, const rec_t*, const dict_index_t*, const rec_offs*)>; _ArgTypes = {const dtuple_t*, const unsigned char*, const dict_index_t*, const short unsigned int*}]’ declared here
        267 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
            |       ^~~~~~~~~~
      /home/thiru/source_code/main_work/storage/innobase/fts/fts0exec.cc:676:53: note: ‘<anonymous>’ declared here
        676 |                                sizeof(doc_id_t), 32)) {}
            |                                                     ^
      

      Reproduced with gcc-13.3.0 in release build

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            thiru Thirunarayanan Balathandayuthapani
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 4.75h
                4.75h

                Git Integration

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