From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 2F8CF3858C32; Mon, 27 May 2024 20:18:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F8CF3858C32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F8CF3858C32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716841103; cv=none; b=TEBFvcnExNrt4QE+9Bf851j3ctqUz1nksyYHVKavoR60EruCer5z2uIUr2w9AygMwW0gNWqm2SKc7m6ndW77Hs7J7QvJ67Deba/ewH+HhxFDiVpXV7K7AgEgTNC0J+gSf3OCEKyVITF95667w5w/owjp6LjrNXd5MF1oV45ncyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716841103; c=relaxed/simple; bh=CNGAWyuGGXWuxd/YJxeH1chMm5Tlz7WqP1JW+VelsXw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=msYvCAlny9/6orB8V46AfTJ13akIThSWgl5jhND2GIh8FEXLg5TlWbs17mVd6t6nSlu1LBipARBWvEwTu/MHTWBcZDY2FXfpz735ogznRrc2I//9nhEsxGZRwVVnTyJFfDAXF8MRSRpIqM1WviiOVtSNqiImcqhcTg8B4mwUXu8= ARC-Authentication-Results: i=1; server2.sourceware.org From: Sam James To: =?utf-8?Q?Fran=C3=A7ois?= Dumont Cc: libstdc++ , gcc-patches Subject: Re: [PATCH] Fix -Wstringop-overflow warning in 23_containers/vector/types/1.cc In-Reply-To: <4657346e-3046-424a-be1d-32a7eaecae32@gmail.com> (=?utf-8?Q?=22Fran=C3=A7ois?= Dumont"'s message of "Mon, 27 May 2024 22:07:42 +0200") Organization: Gentoo References: <4657346e-3046-424a-be1d-32a7eaecae32@gmail.com> Date: Mon, 27 May 2024 21:18:12 +0100 Message-ID: <87a5kbggaj.fsf@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,BODY_8BITS,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Fran=C3=A7ois Dumont writes: > In C++98 this test fails with: For this, and your other -Wfree-nonheap-object patches, could you see if it helps with any of the bugs reported for both -Wstringop-overflow and -Wfree-nonheap-object in libstdc++? There's a bunch of (possible) dupes that it'd be worth tagging if any of them are applicable. > > Excess errors: > /home/fdumont/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits= /stl_algobase.h:452: > warning: 'void* __builtin_memcpy(void*, const void*, long unsigned > int)' writing between 2 and 9223372036854775806 bytes into a region of > size 0 overflows the destination [-Wstringop-overflow=3D] > > The attached patch avoids this warning. > > =C2=A0=C2=A0=C2=A0 libstdc++: Fix -Wstringop-overflow warning coming from= std::vector > > =C2=A0=C2=A0=C2=A0 Make vector<>::_M_range_insert implementation more tra= nsparent to > the compiler checks. > > =C2=A0=C2=A0=C2=A0 Extend local copies of members to the whole method sco= pe so that > all branches benefit > =C2=A0=C2=A0=C2=A0 from those. > > =C2=A0=C2=A0=C2=A0 libstdc++-v3/ChangeLog: > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * incl= ude/bits/vector.tcc > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (std::= vector<>::_M_range_insert(iterator, _FwdIt, _FwdIt, > forward_iterator_tag)): > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Use lo= cal copies of members to call the different algorithms. > > Ok to commit if all tests passes ? > > Fran=C3=A7ois > > [2. text/plain; vector_range_insert_patch.txt]...