diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-09-29 11:03:22 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-09-29 11:03:22 -0400 |
commit | 6288da13acb4022897ca2fcf33278cd0e3dabb41 (patch) | |
tree | 1671dc4a4fab2550f87480d3cc5cca51047569d7 /src/rp2040 | |
parent | 34870d3e2a6232d36b53756d24beaf4491cfbdb8 (diff) | |
download | kutter-6288da13acb4022897ca2fcf33278cd0e3dabb41.tar.gz kutter-6288da13acb4022897ca2fcf33278cd0e3dabb41.tar.xz kutter-6288da13acb4022897ca2fcf33278cd0e3dabb41.zip |
rp2040: Suppress spurious gcc v12 array bounds warning
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/rp2040')
-rw-r--r-- | src/rp2040/bootrom.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rp2040/bootrom.c b/src/rp2040/bootrom.c index 99e60f2d..6e6c46e9 100644 --- a/src/rp2040/bootrom.c +++ b/src/rp2040/bootrom.c @@ -15,13 +15,23 @@ // to (especially for the flash functions) call while the XIP layer // is unavailable. +static __always_inline void *rom_hword_as_ptr(uint16_t rom_address) { +#if defined(__GNUC__) && (__GNUC__ >= 12) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" + return (void *)(uintptr_t)*(uint16_t *)(uintptr_t)rom_address; +#pragma GCC diagnostic pop +#else + return (void *)(uintptr_t)*(uint16_t *)(uintptr_t)rom_address; +#endif +} + static void * _ramfunc rom_func_lookup(uint32_t code) { // Table and lookup function are provided by the BOOTROM - void *(*fn)(uint16_t *, uint32_t) = - (void *)(uintptr_t)(*(uint16_t *)0x18); - uint16_t *table = (uint16_t *)(uintptr_t)(*(uint16_t *)0x14); + void *(*fn)(uint16_t *, uint32_t) = rom_hword_as_ptr(0x18); + uint16_t *table = rom_hword_as_ptr(0x14); return fn(table, code); } |