epics-base / pva2pva

PV Access gateway/proxy and EPICS Process Database integration
https://epics-base.github.io/pva2pva/
Other
4 stars 13 forks source link

Compiler warning: stringop-overread #55

Open dirk-zimoch opened 1 year ago

dirk-zimoch commented 1 year ago

gcc version 12 using c++20 generates a warning in this line: https://github.com/epics-base/pva2pva/blob/3b9990e3650fca2673eebfb83645193ac0e5297d/p2pApp/channel.cpp#L181 gcc version 11 or c++17 does not show any warning.

The warning is quite hard to interpret and contains no reference to the line that causes it:

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 /afs/psi.ch/group/8211/dirk/base-7.0.7/include/epicsTime.h:31,
                 from /afs/psi.ch/group/8211/dirk/base-7.0.7/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:1843:41: error: ‘int __builtin_memcmp(const void*, const void*, long unsigned int)’ specified bound [9223372036854775808, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread]
 1843 |                       = __builtin_memcmp(&*__first1, &*__first2, __len) <=> 0;
      |                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~