Skip to content

Commit 61f91de

Browse files
committed
stm32/sdram: Prevent array-bounds warnings with GCC 11.
Signed-off-by: Damien George <[email protected]>
1 parent cf849d8 commit 61f91de

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ports/stm32/sdram.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ void sdram_leave_low_power(void) {
276276
(0 << 9U)); // Mode Register Definition
277277
}
278278

279+
#if __GNUC__ >= 11
280+
// Prevent array bounds warnings when accessing SDRAM_START_ADDRESS as a memory pointer.
281+
#pragma GCC diagnostic push
282+
#pragma GCC diagnostic ignored "-Warray-bounds"
283+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
284+
#endif
285+
279286
bool sdram_test(bool fast) {
280287
uint8_t const pattern = 0xaa;
281288
uint8_t const antipattern = 0x55;
@@ -325,4 +332,8 @@ bool sdram_test(bool fast) {
325332
return true;
326333
}
327334

335+
#if __GNUC__ >= 11
336+
#pragma GCC diagnostic pop
337+
#endif
338+
328339
#endif // FMC_SDRAM_BANK

0 commit comments

Comments
 (0)