https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106780

            Bug ID: 106780
           Summary: gcc maybe-uninitialized warning on std_function.h
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent.lextrait at gmail dot com
  Target Milestone: ---

Maybe not the right place to report this bug. Apologies in advance if it is
not. I am using the ready-made gcc-12.1.0_1 version of gcc-12.1.0 downloaded
with brew on a Mac.

The compilation flags are -Wall -Wextra -pedantic-errors.

gcc warns when including the regex header:

In constructor 'std::function<_Res(_ArgTypes
...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool;
_ArgTypes = {char}]',
    inlined from
'std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&)
[with _Char_type = char]' at
/usr/local/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/regex_automaton.h:149:4,
    inlined from
'std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&)
[with _Char_type = char]' at
/usr/local/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/regex_automaton.h:146:7,
    inlined from 'std::__detail::_StateIdT
std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT =
std::__cxx11::regex_traits<char>]' at
/usr/local/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/regex_automaton.h:290:24:
/usr/local/Cellar/gcc@12/12.1.0_1/include/c++/12/bits/std_function.h:405:42:
warning: '*(std::function<bool(char)>*)((char*)&__tmp +
offsetof(std::__detail::_StateT,
std::__detail::_State<char>::<unnamed>.std::__detail::_State_base::<unnamed>)).std::function<bool(char)>::_M_invoker'
may be used uninitialized [-Wmaybe-uninitialized]
  405 |       : _Function_base(), _M_invoker(__x._M_invoker)
      |                                      ~~~~^~~~~~~~~~

Reply via email to