Skip to content

Strange warning in channel.cpp #69

@dirk-zimoch

Description

@dirk-zimoch

When compiling p2pApp/channel.cpp with gcc versions 12 to 14 using option -std=c++20 or -std=c++2a (but not with -std=c++17 or lower or with gcc versions 11 or 10, which is the lowest that supports -std=c++20) I get this confusing warning:

In file included from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/string:50,
                 from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/stdexcept:39,
                 from /home/zimoch/epics/epics-base-7.0/include/epicsTime.h:31,
                 from /home/zimoch/epics/epics-base-7.0/include/epicsTimer.h:20,
                 from ../channel.cpp:4:
In function ‘constexpr decltype (__comp((* __first1), (* __first2))) std::lexicographical_compare_three_way(_InputIter1, _InputIter1, _InputIter2, _InputIter2, _Comp) [with _InputIter1 = __gnu_cxx::__normal_iterator<const unsigned char*, vector<unsigned char> >; _InputIter2 = __gnu_cxx::__normal_iterator<const unsigned char*, vector<unsigned char> >; _Comp = __detail::_Synth3way]’,
    inlined from ‘constexpr std::__detail::__synth3way_t<_Iterator> std::operator<=>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&) [with _Tp = unsigned char; _Alloc = allocator<unsigned char>]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_vector.h:2056:52,
    inlined from ‘constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = std::vector<unsigned char>]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_function.h:408:20,
    inlined from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = std::vector<unsigned char>; _Val = std::pair<const std::vector<unsigned char>, std::weak_ptr<MonitorCacheEntry> >; _KeyOfValue = std::_Select1st<std::pair<const std::vector<unsigned char>, std::weak_ptr<MonitorCacheEntry> > >; _Compare = std::less<std::vector<unsigned char> >; _Alloc = std::allocator<std::pair<const std::vector<unsigned char>, std::weak_ptr<MonitorCacheEntry> > >]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_tree.h:2117:35:
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_algobase.h:1846:39: warning: ‘int __builtin_memcmp(const void*, const void*, long unsigned int)’ specified bound [9223372036854775808, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Wstringop-overread]
 1846 |                     = __builtin_memcmp(&*__first1, &*__first2, __blen) <=> 0;
      |                       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Strangely, the warning does not reference the line in channel.cpp that causes the warning. But I pinned it down to:

ment->weakref = ment;

(Pinned down meaning: The warning goes away when I comment out that line.)

May actually be a compiler problem (false positive).

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions