Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>
Cc: Michael Sturm <michael.sturm@intel.com>,
	palves@redhat.com,	eliz@gnu.org, mark.kettenis@xs4all.nl,
	walfred.tedeschi@intel.com,	gdb-patches@sourceware.org
Subject: Re: [PATCH V5 2/3] Add AVX512 register support to gdbserver.
Date: Sat, 13 Dec 2014 13:41:00 -0000	[thread overview]
Message-ID: <20141213134146.GE5457@adacore.com> (raw)
In-Reply-To: <87ppcgrh0o.fsf@br87z6lw.de.ibm.com>

> While building GDB I encountered a gcc warning (array subscript above
> array bounds) and tracked it down to the patch below.

Thanks!

> On Wed, Apr 23 2014, Michael Sturm wrote:
> 
> >  # Linux object files.  This is so we don't have to repeat
> > diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c
> > index e655f74..c2d0bdf 100644
> > --- a/gdb/gdbserver/i387-fp.c
> > +++ b/gdb/gdbserver/i387-fp.c
> > @@ -22,6 +22,11 @@
> >  
> >  static const int num_mpx_bnd_registers = 4;
> >  static const int num_mpx_cfg_registers = 2;
> > +static const int num_avx512_k_registers = 8;
> > +static const int num_avx512_zmmh_low_registers = 16;
> > +static const int num_avx512_zmmh_high_registers = 16;
> > +static const int num_avx512_ymmh_registers = 16;
> > +static const int num_avx512_xmm_registers = 16;
> >  
> >  /* Note: These functions preserve the reserved bits in control registers.
> >     However, gdbserver promptly throws away that information.  */
> > @@ -120,6 +125,17 @@ struct i387_xsave {
> >    /* Space for 2 MPX configuration registers of 64 bits
> >       plus reserved space.  */
> >    unsigned char mpx_cfg_space[16];
> > +
> > +  unsigned char reserved5[48];
> > +
> > +  /* Space for 8 OpMask register values of 64 bits.  */
> > +  unsigned char k_space[64];
> > +
> > +  /* Space for 16 256-bit zmm0-15.  */
> > +  unsigned char zmmh_low_space[512];
> > +
> > +  /* Space for 16 512-bit zmm16-31 values.  */
> > +  unsigned char zmmh_high_space[1024];
> >  };
> >
> > [...]
> > +
> > +  /* Check if any of ZMM16H-ZMM31H registers are changed.  */
> > +  if ((x86_xcr0 & I386_XSTATE_ZMM))
> > +    {
> > +      int zmm16h_regnum = find_regno (regcache->tdesc, "zmm16h");
> > +
> > +      for (i = 0; i < num_avx512_zmmh_high_registers; i++)
> > +	{
> > +	  collect_register (regcache, i + zmm16h_regnum, raw);
> > +	  p = ((char *) &fp->zmmh_low_space[0]) + 32 + i * 64;
>                              ^^^^^^^^^^^^^^
> Should this really mean 'zmm_high_space'?
> 
> > +	  if (memcmp (raw, p, 32) != 0)
> 
> The warning occurs for this memcmp().

Based on the comments in "struct i387_xsave", I think you are right!
Michael and/or Pedro, can anyone confirm, please?

Thank you,
-- 
Joel


  reply	other threads:[~2014-12-13 13:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 13:03 [PATCH V5 0/3] Intel(R) AVX-512 register support Michael Sturm
2014-04-23 13:03 ` [PATCH V5 2/3] Add AVX512 register support to gdbserver Michael Sturm
2014-11-21 10:21   ` Andreas Arnez
2014-12-13 13:41     ` Joel Brobecker [this message]
2015-01-08 10:01       ` Sturm, Michael
2015-01-10  7:00         ` Joel Brobecker
2014-04-23 13:03 ` [PATCH V5 3/3] Add AVX512 feature description to GDB manual Michael Sturm
2013-12-03 12:37   ` [PATCH v3 1/1] Documentation for MPX Walfred Tedeschi
2013-12-03 12:52     ` Eli Zaretskii
2014-08-04 16:57     ` Incorrect placement of two Intel gdb/NEWS items Jan Kratochvil
2014-08-04 19:17       ` Eli Zaretskii
2014-08-04 19:40         ` [commit+7.8] " Jan Kratochvil
2014-04-23 13:04 ` [PATCH V5 1/3] Add AVX512 registers support to GDB Michael Sturm
2014-04-24 11:33   ` Pedro Alves
2014-04-24 11:48   ` Pedro Alves
2014-04-24 11:49 ` [PATCH V5 0/3] Intel(R) AVX-512 register support Pedro Alves

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=20141213134146.GE5457@adacore.com \
    --to=brobecker@adacore.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=michael.sturm@intel.com \
    --cc=palves@redhat.com \
    --cc=walfred.tedeschi@intel.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