lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] LLVM libc++


From: Greg Chicares
Subject: Re: [lmi] LLVM libc++
Date: Wed, 5 Oct 2022 15:58:03 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0

On 10/4/22 16:12, Vadim Zeitlin wrote:
> On Tue, 4 Oct 2022 15:02:26 +0000 Greg Chicares <gchicares@sbcglobal.net> 
> wrote:
> 
> GC> I'm doing something equivalent to your patch, but I've run into two
> GC> linker problems.

Without even addressing those problems yet, I've found another, which
is triggered by llvm's unwind library, with gcc and libstdc++'s regex
in combination with ubsan:

--8<----8<----8<----8<----8<----8<----8<----8<----8<--
In file included from /usr/include/c++/12/regex:48,
                 from /opt/lmi/src/lmi/test_main.cpp:70,
                 from /opt/lmi/src/lmi/test_tools.hpp:310,
                 from /opt/lmi/src/lmi/callback_test.cpp:26:
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/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/include/c++/12/bits/regex_automaton.h:146:7,
    inlined from ‘std::__detail::_StateIdT 
std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_e
nd() [with _TraitsT = std::__cxx11::regex_traits<char>]’ at 
/usr/include/c++/12/bits/regex_au
tomaton.h:290:24:
/usr/include/c++/12/bits/std_function.h:405:42: error: 
‘*(std::function<bool(char)>*)((char*)
&__tmp + offsetof(std::__detail::_StateT, 
std::__detail::_State<char>::<unnamed>.std::__detai
l::_State_base::<unnamed>)).std::function<bool(char)>::_M_invoker’ may be used 
uninitialized 
[-Werror=maybe-uninitialized]
  405 |       : _Function_base(), _M_invoker(__x._M_invoker)
      |                                      ~~~~^~~~~~~~~~
In file included from /usr/include/c++/12/regex:63:
/usr/include/c++/12/bits/regex_automaton.h: In member function 
‘std::__detail::_StateIdT std:
:__detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = 
std::__cxx11::regex_trait
s<char>]’:
/usr/include/c++/12/bits/regex_automaton.h:287:17: note: ‘__tmp’ declared here
  287 |         _StateT __tmp(_S_opcode_subexpr_end);
      |                 ^~~~~
In member function ‘bool std::_Function_base::_M_empty() const’,
    inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const 
[with _Res = bool; _ArgTypes = {char}]’ at 
/usr/include/c++/12/bits/std_function.h:574:25,
    inlined from ‘std::function<_Res(_ArgTypes 
...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; 
_ArgTypes = {char}]’ at /usr/include/c++/12/bits/std_function.h:407:6,
    inlined from 
‘std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&) 
[with _Char_type = char]’ at /usr/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/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/include/c++/12/bits/regex_automaton.h:290:24:
/usr/include/c++/12/bits/std_function.h:247:37: error: ‘*(const 
std::_Function_base*)((char*)&__tmp + offsetof(std::__detail::_StateT, 
std::__detail::_State<char>::<unnamed>.std::__detail::_State_base::<unnamed>)).std::_Function_base::_M_manager’
 may be used uninitialized [-Werror=maybe-uninitialized]
  247 |     bool _M_empty() const { return !_M_manager; }
      |                                     ^~~~~~~~~~
/usr/include/c++/12/bits/regex_automaton.h: In member function 
‘std::__detail::_StateIdT 
std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_end() [with _TraitsT = 
std::__cxx11::regex_traits<char>]’:
/usr/include/c++/12/bits/regex_automaton.h:287:17: note: ‘__tmp’ declared here
  287 |         _StateT __tmp(_S_opcode_subexpr_end);
--8<----8<----8<----8<----8<----8<----8<----8<----8<--

We've seen something like this before:

  commit 5a4fcaed7309f5d4caee3443538ceb3edf0e119b
  Author: Gregory W. Chicares <gchicares@sbcglobal.net>
  Date:   2022-08-18T16:22:15+00:00
  [...]
  +# gcc-12 gives spurious warnings when <regex> is used. See:
  +#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562
  +# For lmi, this seems to affect only UBSAN builds.

Now, with llvm's unwinder, it affects unit tests as well,
and the resolution is the same: '-Wno-maybe-uninitialized',
only if target-is-affected AND gcc AND ubsan. Thus, we still
have a complete UBSAN build (using clang), and we still have
an unwinder in all unit tests (which is crucial to me) even
with gcc.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]