[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] blktap2: update connection handling to fix build with gcc5



>>> On 20.07.15 at 11:16, <olaf@xxxxxxxxx> wrote:
> On Mon, Jul 20, Jan Beulich wrote:
> 
>> >>> On 19.07.15 at 11:33, <olaf@xxxxxxxxx> wrote:
>> > [  198s] block-log.c:549:23: error: array subscript is above array bounds 
> [-Werror=array-bounds]
>> > [  198s]      if (s->connections[i].id == id)
>> > [  198s]                        ^
>> 
>> So what makes the compiler right with that complaint? I.e. how does
>> it know i > 0 here? After all - afaict - s->connected can only be 0 or
> 
> It has to assume that ->connected can get any value because the input
> comes from outside the unit.

But then the warning can't be "is" but only "may be", and a similar
warning would appear for _all_ other array accesses with compile
time known upper bound (and that's clearly not the case). I'm
guessing that the compiler wrongly applies a heuristic that every
loop over an array has at least two iteration (or some such).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.