Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler warning: stringop-overread #55

Open
dirk-zimoch opened this issue Mar 10, 2023 · 0 comments
Open

Compiler warning: stringop-overread #55

dirk-zimoch opened this issue Mar 10, 2023 · 0 comments

Comments

@dirk-zimoch
Copy link

gcc version 12 using c++20 generates a warning in this line:

entry->mon_entries[ser] = ment; // ref. wrapped

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;
      |                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@dirk-zimoch dirk-zimoch changed the title Compiler warning: Compiler warning: stringop-overread Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant