tools: Fix bccmd build with GCC 4.9
PATCH 1/1 tools: Fix bccmd build with GCC 4.9
Make sure accessing array[63 * 2 + 4] is legal.
tools/bccmd.c: In function ‘cmd_buildname’:tools/bccmd.c:406:18: error: iteration 63u invokes undefined behavior
[-Werror=aggressive-loop-optimizations]
name[i] = array[(i * 2) + 4];
--- tools/bccmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bccmd.c +1 -1
@@ -389,7 +389,7 @@ static int cmd_chiprev(int transport, int argc, char *argv[])static int cmd_buildname (int transport,int argc,char *argv[]) { -uint8_t array[130 ]; +uint8_t array[131 ];char name[64 ];unsigned int i;int err;
Signature · 1 line
1.9.1
Johan Hedberg
AppliedHi Szymon,
Quoted 9 lines · Szymon Janc
Make sure accessing array[63 * 2 + 4] is legal.
tools/bccmd.c: In function ‘cmd_buildname’:tools/bccmd.c:406:18: error: iteration 63u invokes undefined behavior
[-Werror=aggressive-loop-optimizations]
name[i] = array[(i * 2) + 4];--- tools/bccmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied. Thanks.
Johan