summaryrefslogtreecommitdiffstats
path: root/debian/patches/openbios-array-bounds-gcc12.patch
blob: a96048b16ce1ec33329e6d4a6d1843bf71240fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Subject: openbios: do not error-out array-bounds warning
From: Michael Tokarev <mjt@tls.msk.ru>
Date: Fri, 02 Sep 2022 18:35:30 +0300

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
--- a/roms/openbios/arch/ppc/qemu/init.c
+++ b/roms/openbios/arch/ppc/qemu/init.c
@@ -397,4 +397,7 @@ ppc64_patch_handlers(void)
     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;