Skip to content

Commit

Permalink
stm32/boards/PYBD_SF2: Disable GCC 11 warnings for array bounds.
Browse files Browse the repository at this point in the history
With GCC 11 there is now a warning about array bounds of OTP-mac, due to
the OTP being a literal address.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed May 27, 2021
1 parent 62f7537 commit 211c3e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ports/stm32/boards/PYBD_SF2/board_init.c
Expand Up @@ -64,7 +64,15 @@ void board_sleep(int value) {
void mp_hal_get_mac(int idx, uint8_t buf[6]) {
// Check if OTP region has a valid MAC address, and use it if it does
if (OTP->series == 0x00d1 && OTP->mac[0] == 'H' && OTP->mac[1] == 'J' && OTP->mac[2] == '0') {
#if __GNUC__ >= 11
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
memcpy(buf, OTP->mac, 6);
#if __GNUC__ >= 11
#pragma GCC diagnostic pop
#endif
buf[5] += idx;
return;
}
Expand Down

0 comments on commit 211c3e4

Please sign in to comment.