[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 Mon, 20 Jul 2015, Jan Beulich wrote:

> >>> On 19.07.15 at 11:33, <olaf@xxxxxxxxx> wrote:
> > blktap2 fails to build with gcc5 because it fails to recognize that
> > there can be just one active connection (enforced in ctl_accept).
> > 
> > Rearrange the code to handle just a single connection.
> > Adjust two strerror calls to use errno instead -1 as input.
> > 
> > [  198s] block-log.c: In function 'ctl_close_sock':
> > [  198s] block-log.c:363:23: error: array subscript is above array bounds 
> > [-Werror=array-bounds]
> > [  198s]      if (s->connections[i].fd == fd) {
> > [  198s]                        ^
> > [  198s] block-log.c: In function 'ctl_request':
> > [  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
> 1, and hence either the loop bodies don't get entered at all or the
> loops have only a single iteration. Smells like a compiler bug instead,
> which I'm not sure we want to work around with a non-trivial patch
> like this.

Does this depend on the gcc 5 version? I think this is something I thought 
I was going to have to fix on Fedora and then found I didn't.

        Michael Young

_______________________________________________
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®.