From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27807 invoked by alias); 13 Dec 2014 13:41:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27797 invoked by uid 89); 13 Dec 2014 13:41:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 13 Dec 2014 13:41:48 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9A8AC11638E; Sat, 13 Dec 2014 08:41:46 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Vzya-aRkDspW; Sat, 13 Dec 2014 08:41:46 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 27AEC116384; Sat, 13 Dec 2014 08:41:46 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id E821940164; Sat, 13 Dec 2014 08:41:46 -0500 (EST) Date: Sat, 13 Dec 2014 13:41:00 -0000 From: Joel Brobecker To: Andreas Arnez Cc: Michael Sturm , 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. Message-ID: <20141213134146.GE5457@adacore.com> References: <1398258160-9070-1-git-send-email-michael.sturm@intel.com> <1398258160-9070-3-git-send-email-michael.sturm@intel.com> <87ppcgrh0o.fsf@br87z6lw.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ppcgrh0o.fsf@br87z6lw.de.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-12/txt/msg00309.txt.bz2 > 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