Skip to contentSkip to conversation

tools: Fix bccmd build with GCC 4.9

PATCH Applied Szymon Janc 2 participants 2 messages Apr 2, 2014 – Apr 3, 2014 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

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
index ff1b307..4649ad5 100644
@@ -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
#1 lore raw

Hi 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