On 22 December 2016 at 17:13, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia-bell-labs.com> wrote:

>
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> Mike
> > Holmes
> > Sent: Thursday, December 22, 2016 4:08 PM
> > To: Maxim Uvarov <maxim.uva...@linaro.org>
> > Cc: lng-odp <lng-odp@lists.linaro.org>
> > Subject: Re: [lng-odp] [PATCHv2] linux-generic: packet: fix buggy
> compiler
> > error
> >
> > On 22 December 2016 at 08:49, Maxim Uvarov <maxim.uva...@linaro.org>
> > wrote:
> >
> > > On debian jessie gcc unable to compile current code
> > > with error:
> > > odp_packet.c: In function 'odp_packet_trunc_head':
> > > odp_packet.c:314:46: error: array subscript is above array bounds
> > > [-Werror=array-bounds]
> > > to->buf_hdr.seg[i].len = from->buf_hdr.seg[num + i].len;
> > >
> > > The problem is that it breaks compilation only on .len line:
> > > for (i = 0; i < num; i++) {
> > >         to->buf_hdr.seg[i].hdr  = from->buf_hdr.seg[num + i].hdr;
> > >         to->buf_hdr.seg[i].data = from->buf_hdr.seg[num + i].data;
> > >         to->buf_hdr.seg[i].len  = from->buf_hdr.seg[num + i].len;
> > > }
> > >
> > > If that line is commented out compilation passes. If lines are
> reordered
> > > than compilation also fails on .len line. Because there is no warning
> on
> > > .hdr and .data it looks like compiler error. Additional check for
> > > preconfigured value is workaround to that situation.
> > >
> > > Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
> > >
> >
> > Reviewed-by: Mike Holmes <mike.hol...@linaro.org>
> >
> > -O3 now passes for me on x86 gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
> >
>
> I'll send shortly a patch set which modifies also this function. I think
> it should remove the issue also.
>
> -Petri
>
> Ok, waiting.

Reply via email to