summaryrefslogtreecommitdiffstats
path: root/debian/patches/gcc12_build_array_bounds2.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:52 +0000
commitca67b09c015d4af3ae3cce12aa72e60941dbb8b5 (patch)
treeb7316d7b06c373e08dabb79a2c866c568e08f49e /debian/patches/gcc12_build_array_bounds2.patch
parentAdding upstream version 2.06. (diff)
downloadgrub2-ca67b09c015d4af3ae3cce12aa72e60941dbb8b5.tar.xz
grub2-ca67b09c015d4af3ae3cce12aa72e60941dbb8b5.zip
Adding debian version 2.06-13+deb12u1.debian/2.06-13+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/gcc12_build_array_bounds2.patch')
-rw-r--r--debian/patches/gcc12_build_array_bounds2.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/patches/gcc12_build_array_bounds2.patch b/debian/patches/gcc12_build_array_bounds2.patch
new file mode 100644
index 0000000..6036eba
--- /dev/null
+++ b/debian/patches/gcc12_build_array_bounds2.patch
@@ -0,0 +1,46 @@
+commit 3ce13d974b887338ae972c79b41ff6fc0eee6388
+Author: Michael Chang <mchang@suse.com>
+Date: Mon Mar 28 15:00:54 2022 +0800
+
+ lib/reed_solomon: Fix array subscript 0 is outside array bounds
+
+ The grub_absolute_pointer() is a compound expression that can only work
+ within a function. We are out of luck here when the pointer variables
+ require global definition due to ATTRIBUTE_TEXT that have to use fully
+ initialized global definition because of the way linkers work.
+
+ static gf_single_t * const gf_powx ATTRIBUTE_TEXT = (void *) 0x100000;
+
+ For the reason given above, use GCC diagnostic pragmas to suppress the
+ array-bounds warning.
+
+ Signed-off-by: Michael Chang <mchang@suse.com>
+ Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+
+diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c
+index 82779a296..562bd2e3e 100644
+--- a/grub-core/lib/reed_solomon.c
++++ b/grub-core/lib/reed_solomon.c
+@@ -102,6 +102,11 @@ static gf_single_t errvals[256];
+ static gf_single_t eqstat[65536 + 256];
+ #endif
+
++#if __GNUC__ == 12
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ static gf_single_t
+ gf_mul (gf_single_t a, gf_single_t b)
+ {
+@@ -319,6 +324,10 @@ decode_block (gf_single_t *ptr, grub_size_t s,
+ }
+ }
+
++#if __GNUC__ == 12
++#pragma GCC diagnostic pop
++#endif
++
+ #if !defined (STANDALONE)
+ static void
+ encode_block (gf_single_t *ptr, grub_size_t s,