mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
AP_HAL_ChibiOS: ignore array bounds check while checking 0x0 for writes
Fixes compiler error on g++ 12 ../../libraries/AP_HAL_ChibiOS/Scheduler.cpp:568:20: error: array subscript 0 is outside array bounds of 'const uint8_t [0]' [-Werror=array-bounds] 568 | if (addr0[i] != 0) {
This commit is contained in:
parent
bba5b34c1e
commit
08f652fe2c
@ -565,10 +565,13 @@ void Scheduler::check_low_memory_is_zero()
|
|||||||
// we can't do address 0, but can check next 3 bytes
|
// we can't do address 0, but can check next 3 bytes
|
||||||
const uint8_t *addr0 = (const uint8_t *)0;
|
const uint8_t *addr0 = (const uint8_t *)0;
|
||||||
for (uint8_t i=1; i<4; i++) {
|
for (uint8_t i=1; i<4; i++) {
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
if (addr0[i] != 0) {
|
if (addr0[i] != 0) {
|
||||||
AP_memory_guard_error(1023);
|
AP_memory_guard_error(1023);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // STM32H7
|
#endif // STM32H7
|
||||||
|
Loading…
Reference in New Issue
Block a user