From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id APG3AX9S0GMdnyAAWB0awg (envelope-from ) for ; Tue, 24 Jan 2023 16:49:51 -0500 Received: by simark.ca (Postfix, from userid 112) id 02C311E128; Tue, 24 Jan 2023 16:49:51 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9C36E1E110 for ; Tue, 24 Jan 2023 16:49:50 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 100BA385842C for ; Tue, 24 Jan 2023 21:49:50 +0000 (GMT) Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 3792F3858D28 for ; Tue, 24 Jan 2023 21:49:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3792F3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: by gnu.wildebeest.org (Postfix, from userid 1000) id 2C3DE302BBEC; Tue, 24 Jan 2023 22:49:37 +0100 (CET) Date: Tue, 24 Jan 2023 22:49:37 +0100 From: Mark Wielaard To: Simon Marchi Cc: gdb-patches@sourceware.org, John Baldwin , Sam James , Tom Tromey Subject: Re: [PATCHv3] gdb: Replace memcpy with std::copy to avoid some g++ warnings on sparc Message-ID: <20230124214937.GH11538@gnu.wildebeest.org> References: <20230124201624.875658-1-mark@klomp.org> <2f5e28eb-a5f2-0995-506f-b6632333c7b2@simark.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f5e28eb-a5f2-0995-506f-b6632333c7b2@simark.ca> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Simon, On Tue, Jan 24, 2023 at 04:29:20PM -0500, Simon Marchi wrote: > > diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c > > index 203390d9880..ebc15543149 100644 > > --- a/gdb/fbsd-tdep.c > > +++ b/gdb/fbsd-tdep.c > > @@ -662,8 +662,9 @@ fbsd_make_note_desc (enum target_object object, uint32_t structsize) > > return buf; > > > > gdb::byte_vector desc (sizeof (structsize) + buf->size ()); > > - memcpy (desc.data (), &structsize, sizeof (structsize)); > > - memcpy (desc.data () + sizeof (structsize), buf->data (), buf->size ()); > > + std::copy (&structsize, &structsize + sizeof (structsize), desc.data ()); > > + std::copy (buf->data (), desc.data () + sizeof (structsize), > > + desc.data () + sizeof (structsize)); > > I think the second argument to the second std::copy call should have > `buf->data ()`, not `desc.data (). Otherwise, LGTM. However, it would > be nice to have the approval from John Baldwin. Bah, what a stupid typo. You are right of course. Sorry. v4 coming up. Thanks, Mark