public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "boris at kolpackov dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101361] New: Bogus -Wstringop-overread warning with -O3 Date: Wed, 07 Jul 2021 06:25:48 +0000 [thread overview] Message-ID: <bug-101361-4@http.gcc.gnu.org/bugzilla/> (raw) 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; } | ^~~~
next reply other threads:[~2021-07-07 6:25 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-07 6:25 boris at kolpackov dot net [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-101361-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).