public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Simon Marchi <simark@simark.ca>
Cc: gdb-patches@sourceware.org, John Baldwin <jhb@FreeBSD.org>,
	Sam James <sam@gentoo.org>, Tom Tromey <tom@tromey.com>
Subject: Re: [PATCHv3] gdb: Replace memcpy with std::copy to avoid some g++ warnings on sparc
Date: Tue, 24 Jan 2023 22:49:37 +0100	[thread overview]
Message-ID: <20230124214937.GH11538@gnu.wildebeest.org> (raw)
In-Reply-To: <2f5e28eb-a5f2-0995-506f-b6632333c7b2@simark.ca>

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

      reply	other threads:[~2023-01-24 21:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 20:16 Mark Wielaard
2023-01-24 21:29 ` Simon Marchi
2023-01-24 21:49   ` Mark Wielaard [this message]

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=20230124214937.GH11538@gnu.wildebeest.org \
    --to=mark@klomp.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=sam@gentoo.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /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: link
Be 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).