From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 86F5C3857346; Thu, 28 Apr 2022 13:42:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86F5C3857346 From: "byteslice at airmail dot cc" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105424] New: Bogus -Wstringop-overread with non-overread condition Date: Thu, 28 Apr 2022 13:42:35 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: byteslice at airmail dot cc 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: Thu, 28 Apr 2022 13:42:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105424 Bug ID: 105424 Summary: Bogus -Wstringop-overread with non-overread condition Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: byteslice at airmail dot cc Target Milestone: --- Created attachment 52897 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52897&action=3Dedit Cvised example On gcc 12.0.1 20220413 (Fedora 36 Beta), with c++ -std=3Dc++20 -O1 -Werror=3Dstringop-overread, the attachment fails to compile, with the foll= owing message: In function 'void boost::memmove(I, F) [with I =3D move_iterator; F = =3D int]', inlined from 'F boost::uninitialized_copy_alloc(Allocator, I, F) [with Allocator =3D vector_alloc_holder; I =3D move_iterator; F =3D int]' at :67:10, inlined from 'void boost::vector::priv_uninitialized_construct_at_end(InpIt, InpIt) [with InpI= t =3D boost::move_iterator]' at :91:45, inlined from 'void boost::vector::assign(FwdIt, FwdIt) [with FwdIt =3D boost::move_iterator]' at :87:42, inlined from 'boost::small_vector::small_vector(boost::small_vector&&)'= at :106:11, inlined from 'Stack::Stack(Stack&&)' at :113:8, inlined from 'pair<_T2>::pair(_U1, _U2) [with _U1 =3D int; _U2 =3D Stac= k; _T2 =3D Stack]' at :5:24, inlined from 'pair Stack::Pop() const' at :118:67: :63:14: error: 'void* memmove(void*, const void*, long unsigned int= )' reading 9 or more bytes from a region of size 4 [-Werror=3Dstringop-overrea= d] 63 | ::memmove(dest_raw, beg_raw, n); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ : In member function 'pair Stack::Pop() const': :103:9: note: source object '__trans_tmp_4' of size 4 103 | int __trans_tmp_4; | ^~~~~~~~~~~~~ cc1plus: some warnings being treated as errors Compiler returned: 1 This warning is bogus because the memmove is guarded by a condition that prevents the size from being more than 4. The bogus warning does not appear= in older versions of GCC. Adding -fno-inline to options allows compilation to succeed.=