[U-Boot] [PATCH] samsung: board: fix: Define loop iterator as an unsigned int to suppress gcc 4.8 warning

This patch suppress following warning:
board/samsung/common/board.c:95:32: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations] addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); ^ board/samsung/common/board.c:94:2: note: containing loop
about possible signed integer overflow at gcc 4.8.2 (odroid board)
Signed-off-by: Lukasz Majewski l.majewski@samsung.com --- board/samsung/common/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 7b10877..d8cf5ab 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -89,7 +89,7 @@ int board_init(void)
int dram_init(void) { - int i; + unsigned int i; u32 addr;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { @@ -101,7 +101,7 @@ int dram_init(void)
void dram_init_banksize(void) { - int i; + unsigned int i; u32 addr, size;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {

On 04/03/15 18:54, Lukasz Majewski wrote:
This patch suppress following warning:
board/samsung/common/board.c:95:32: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations] addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); ^ board/samsung/common/board.c:94:2: note: containing loop
about possible signed integer overflow at gcc 4.8.2 (odroid board)
Signed-off-by: Lukasz Majewski l.majewski@samsung.com
board/samsung/common/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 7b10877..d8cf5ab 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -89,7 +89,7 @@ int board_init(void)
int dram_init(void) {
- int i;
unsigned int i; u32 addr;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
@@ -101,7 +101,7 @@ int dram_init(void)
void dram_init_banksize(void) {
- int i;
unsigned int i; u32 addr, size;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
applied to u-boot-samsung.
Thanks, Minkyu Kang.
participants (2)
-
Lukasz Majewski
-
Minkyu Kang