[ovs-dev] "array subscript is above array bounds" for flowmap_set(), flowmap_clear()

Ben Pfaff blp at nicira.com
Thu Aug 27 00:12:14 UTC 2015


I think the compiler is wrong here.  Not sure what to do about it yet
though.

On Wed, Aug 26, 2015 at 04:50:21PM -0700, Ben Pfaff wrote:
> GCC 4.9 doesn't like flowmap_clear() and flowmap_set().  Maybe that's
> why you had those seemingly redundant tests in there?  I'm taking a
> closer look to see whether I believe its claims though.
> 
>       CC       lib/classifier.lo
>     In file included from ../lib/match.h:20:0,
>                      from ../lib/classifier.h:302,
>                      from ../lib/classifier.c:18:
>     ../lib/classifier.c: In function 'miniflow_get_map_in_range':
>     ../lib/flow.h:520:28: error: array subscript is above array bounds [-Werror=array-bounds]
>              fm->bits[unit + 1] &= ~(n_bits_mask >> (MAP_T_BITS - idx));
>                                 ^
>     ../lib/flow.h:520:28: error: array subscript is above array bounds [-Werror=array-bounds]
>     cc1: all warnings being treated as errors
>     Makefile:3910: recipe for target 'lib/classifier.lo' failed
>     make[2]: *** [lib/classifier.lo] Error 1
>       CC       lib/flow.lo
>     In file included from ../lib/flow.c:18:0:
>     ../lib/flow.c: In function 'miniflow_extract':
>     ../lib/flow.h:502:28: error: array subscript is above array bounds [-Werror=array-bounds]
>              fm->bits[unit + 1] |= n_bits_mask >> (MAP_T_BITS - idx);
>                                 ^
>     ../lib/flow.h:502:28: error: array subscript is above array bounds [-Werror=array-bounds]
>     cc1: all warnings being treated as errors



More information about the dev mailing list