When trying to build atf-marvell with gcc 8, it errors out saying
plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c: In function ‘marvell_get_amb_memory_map’:
plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c:92:33: error: division ‘sizeof (struct amb_win ) / sizeof (struct amb_win)’ does not compute the number of array elements [-Werror=sizeof-pointer-div]
size = sizeof(amb_memory_map)/sizeof(struct amb_win);
^
plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c:79:17: note: first ‘sizeof’ operand was declared here
struct amb_win *amb_memory_map;
^~~~~~
cc1: all warnings being treated as errors
This wasn't detected by earlier versions of gcc, but it looks like it is a genuine problem and *size simply got an incorrect value with earlier gcc -- the compiler can't know the size of the amb_memory_map array (which it sees as just an uninitialized pointer) in this translation unit.
When trying to build atf-marvell with gcc 8, it errors out saying
plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c: In function ‘marvell_get_amb_memory_map’: plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c:92:33: error: division ‘sizeof (struct amb_win ) / sizeof (struct amb_win)’ does not compute the number of array elements [-Werror=sizeof-pointer-div] size = sizeof(amb_memory_map)/sizeof(struct amb_win); ^ plat/marvell/a8k/a80x0_mcbin/board/marvell_plat_config.c:79:17: note: first ‘sizeof’ operand was declared here struct amb_win *amb_memory_map; ^
~~~~~ cc1: all warnings being treated as errorsThis wasn't detected by earlier versions of gcc, but it looks like it is a genuine problem and *size simply got an incorrect value with earlier gcc -- the compiler can't know the size of the amb_memory_map array (which it sees as just an uninitialized pointer) in this translation unit.