From d9502318993d40a6efba1eac9e2a11271c4fd81d Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Fri, 2 Sep 2022 18:35:30 +0300 Subject: [PATCH] openbios: do not error-out array-bounds warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc-12.2 produces an apparently wrong warning for this file: roms/openbios/arch/ppc/qemu/init.c:400:10: error: \ array subscript 0 is outside array bounds of ‘uint32_t[0]’ {aka ‘unsigned int[]’} \ [-Werror=array-bounds] 400 | *dsi = 0x48002002; | =====^=========== Turn this particular -Werror back into warning. Gcc is apparently wrong here. index e40385a70b..2e214aa079 100644 Gbp-Pq: Name openbios-array-bounds-gcc12.patch Signed-off-by: Cong Liu --- roms/openbios/arch/ppc/qemu/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roms/openbios/arch/ppc/qemu/init.c b/roms/openbios/arch/ppc/qemu/init.c index e40385a70b..2e214aa079 100644 --- a/roms/openbios/arch/ppc/qemu/init.c +++ b/roms/openbios/arch/ppc/qemu/init.c @@ -396,6 +396,9 @@ ppc64_patch_handlers(void) uint32_t *dsi = (uint32_t *)0x300UL; uint32_t *isi = (uint32_t *)0x400UL; +#pragma GCC diagnostic warning "-Warray-bounds" +/* gcc-12 misreports array-bounds error in the following two assignments: */ + // Patch the first DSI handler instruction to: ba 0x2000 *dsi = 0x48002002;