[lib][debugcommands] add a workaround for gcc 12.1
GCC 12 seems to be much more aggressive about warnings about any
dereferences near 0. For this particular piece of code, which is
explicitly trying to force a fault by touching address 1, simply disable
the warning around the block of code.
@@ -305,6 +305,9 @@ static int cmd_sleep(int argc, const console_cmd_args *argv) {
return 0;
}
+/* fix warning for the near-null pointer dereference below with gcc 12.x+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
static int cmd_crash(int argc, const console_cmd_args *argv) {
/* should crash */
volatile uint32_t *ptr = (void *)1;
@@ -315,6 +318,7 @@ static int cmd_crash(int argc, const console_cmd_args *argv) {
return 0;
}
+#pragma GCC diagnostic pop
static int cmd_stackstomp(int argc, const console_cmd_args *argv) {
for (size_t i = 0; i < DEFAULT_STACK_SIZE * 2; i++) {
