Skip to contentSkip to conversation

Please fix warning of gw_ventana board

U-Boot Masahiro Yamada 1 participant 1 message Jul 30, 2014

lore
Share & tools
lore
#0 lore raw

Hi Tim Harvey,

I am afraid I see a warning when building gw_ventana board.

board/gateworks/gw_ventana/gw_ventana.c: In function 'setup_board_gpio':
board/gateworks/gw_ventana/gw_ventana.c:987:27: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
if (gpio_cfg[board].leds[i])

                           ^

board/gateworks/gw_ventana/gw_ventana.c:986:2: note: containing loop
for (i = 0; i < 4; i++) {
^
board/gateworks/gw_ventana/gw_ventana.c: In function 'setup_board_gpio':
board/gateworks/gw_ventana/gw_ventana.c:987:27: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
if (gpio_cfg[board].leds[i])

                           ^

board/gateworks/gw_ventana/gw_ventana.c:986:2: note: containing loop
for (i = 0; i < 4; i++) {
^

The for statement in line 986 iterates 4 times, but the array size of gpio_cfg[board].leds[i] is 2 or 3.

Best Regards
Masahiro Yamada