public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101361] New: Bogus -Wstringop-overread warning with -O3
@ 2021-07-07  6:25 boris at kolpackov dot net
  2021-07-11  8:55 ` [Bug c++/101361] " Theodore.Papadopoulo at inria dot fr
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: boris at kolpackov dot net @ 2021-07-07  6:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101361
           Summary: Bogus -Wstringop-overread warning with -O3
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boris at kolpackov dot net
  Target Milestone: ---

Created attachment 51113
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51113&action=edit
reproducer

g++ -Wall -Wextra -O3 -std=c++2a -o driver.o -c -fdirectives-only driver.ii

In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:40,
                 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
In static member function ‘static constexpr int
std::char_traits<char>::compare(const char_type*, const char_type*,
std::size_t)’,
    inlined from ‘int butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::compare(const C*, butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::size_type, const C*, butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::size_type) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:93:35,
    inlined from ‘bool butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::prefix(const K&, const K&) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:70:18,
    inlined from ‘std::pair<typename M::const_iterator, typename
M::const_iterator> butl::prefix_map_common<M>::find_sub(const key_type&) const
[with M = std::map<std::__cxx11::basic_string<char>, int,
butl::compare_prefix<std::__cxx11::basic_string<char> >,
std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.txx:36:21:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/char_traits.h:361:32:
warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’
specified bound 18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overread]
  361 |         return __builtin_memcmp(__s1, __s2, __n);
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:55,
                 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:
In member function ‘std::pair<typename M::const_iterator, typename
M::const_iterator> butl::prefix_map_common<M>::find_sub(const key_type&) const
[with M = std::map<std::__cxx11::basic_string<char>, int,
butl::compare_prefix<std::__cxx11::basic_string<char> >,
std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >]’:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:187:28:
note: source object allocated here
  187 |       { return _M_dataplus._M_p; }
      |                            ^~~~
In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:40,
                 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
In static member function ‘static constexpr int
std::char_traits<char>::compare(const char_type*, const char_type*,
std::size_t)’,
    inlined from ‘int butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::compare(const C*, butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::size_type, const C*, butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::size_type) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:93:35,
    inlined from ‘bool butl::compare_prefix<std::__cxx11::basic_string<_CharT>
>::prefix(const K&, const K&) const [with C = char]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:70:18,
    inlined from ‘std::pair<typename M::iterator, typename M::iterator>
butl::prefix_map_common<M>::find_sub(const key_type&) [with M =
std::map<std::__cxx11::basic_string<char>, int,
butl::compare_prefix<std::__cxx11::basic_string<char> >,
std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >]’ at
/home/boris/work/build2/libbutl/libbutl/prefix-map.txx:17:21:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/char_traits.h:361:32:
warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’
specified bound 18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overread]
  361 |         return __builtin_memcmp(__s1, __s2, __n);
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/string:55,
                 from
/home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:
In member function ‘std::pair<typename M::iterator, typename M::iterator>
butl::prefix_map_common<M>::find_sub(const key_type&) [with M =
std::map<std::__cxx11::basic_string<char>, int,
butl::compare_prefix<std::__cxx11::basic_string<char> >,
std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >]’:
/home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/bits/basic_string.h:187:28:
note: source object allocated here
  187 |       { return _M_dataplus._M_p; }
      |                            ^~~~

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-03-20 13:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  6:25 [Bug c++/101361] New: Bogus -Wstringop-overread warning with -O3 boris at kolpackov dot net
2021-07-11  8:55 ` [Bug c++/101361] " Theodore.Papadopoulo at inria dot fr
2021-07-11  8:57 ` Theodore.Papadopoulo at inria dot fr
2021-07-12 22:56 ` [Bug libstdc++/101361] " msebor at gcc dot gnu.org
2021-07-13 11:08 ` redi at gcc dot gnu.org
2021-07-13 11:31 ` redi at gcc dot gnu.org
2021-07-13 12:17 ` redi at gcc dot gnu.org
2021-07-13 14:21 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:41 ` msebor at gcc dot gnu.org
2021-07-14 15:00 ` cvs-commit at gcc dot gnu.org
2021-07-14 16:05 ` cvs-commit at gcc dot gnu.org
2021-07-14 16:07 ` [Bug c++/101361] " redi at gcc dot gnu.org
2023-03-20 12:58 ` mail+gnu at tzik dot jp
2023-03-20 13:08 ` mail+gnu at tzik dot jp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).