From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D300A386186A; Wed, 7 Jul 2021 06:25:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D300A386186A From: "boris at kolpackov dot net" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: boris at kolpackov dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 06:25:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101361 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=3D51113&action=3Dedit reproducer g++ -Wall -Wextra -O3 -std=3Dc++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/s= tring:40, from /home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7: In static member function =E2=80=98static constexpr int std::char_traits::compare(const char_type*, const char_type*, std::size_t)=E2=80=99, inlined from =E2=80=98int butl::compare_prefix >::compare(const C*, butl::compare_prefix >::size_type, const C*, butl::compare_prefix >::size_type) const [with C =3D char]=E2=80=99 at /home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:93:35, inlined from =E2=80=98bool butl::compare_prefix >::prefix(const K&, const K&) const [with C =3D char]=E2=80=99 at /home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:70:18, inlined from =E2=80=98std::pair butl::prefix_map_common::find_sub(const key_type&) co= nst [with M =3D std::map, int, butl::compare_prefix >, std::allocator, int> > >]= =E2=80=99 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/b= its/char_traits.h:361:32: warning: =E2=80=98int __builtin_memcmp_eq(const void*, const void*, long un= signed int)=E2=80=99 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/s= tring: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/b= its/basic_string.h: In member function =E2=80=98std::pair butl::prefix_map_common::find_sub(const key_type&) co= nst [with M =3D std::map, int, butl::compare_prefix >, std::allocator, int> > >]= =E2=80=99: /home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/b= its/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/s= tring:40, from /home/boris/work/build2/libbutl/tests/prefix-map/driver.cxx:7: In static member function =E2=80=98static constexpr int std::char_traits::compare(const char_type*, const char_type*, std::size_t)=E2=80=99, inlined from =E2=80=98int butl::compare_prefix >::compare(const C*, butl::compare_prefix >::size_type, const C*, butl::compare_prefix >::size_type) const [with C =3D char]=E2=80=99 at /home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:93:35, inlined from =E2=80=98bool butl::compare_prefix >::prefix(const K&, const K&) const [with C =3D char]=E2=80=99 at /home/boris/work/build2/libbutl/libbutl/prefix-map.mxx:70:18, inlined from =E2=80=98std::pair butl::prefix_map_common::find_sub(const key_type&) [with M =3D std::map, int, butl::compare_prefix >, std::allocator, int> > >]= =E2=80=99 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/b= its/char_traits.h:361:32: warning: =E2=80=98int __builtin_memcmp_eq(const void*, const void*, long un= signed int)=E2=80=99 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/s= tring: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/b= its/basic_string.h: In member function =E2=80=98std::pair butl::prefix_map_common::find_sub(const key_type&) [with M =3D std::map, int, butl::compare_prefix >, std::allocator, int> > >]= =E2=80=99: /home/boris/work/build2/tests/modules/gcc2/gcc-install/include/c++/11.0.1/b= its/basic_string.h:187:28: note: source object allocated here 187 | { return _M_dataplus._M_p; } | ^~~~=