From 9e620058184cfdf026241b953bfbb095256198a0 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Tue, 26 Apr 2022 09:22:10 +0000 Subject: [PATCH] genprotimg/boot: disable `-Warray-bounds` for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This work around fixes the gcc-12 false positive by disabling `Warray-bounds`: CC genprotimg/boot/stage3a.o In file included from stage3a.c:14: In function ‘__test_facility’, inlined from ‘test_facility’ at ../../include/boot/s390.h:428:9, inlined from ‘start’ at stage3a.c:42:7: ../../include/boot/s390.h:418:17: error: array subscript 0 is outside array bounds of ‘void[0]’ [-Werror=array-bounds] 418 | return (*ptr & (0x80 >> (nr & 7))) != 0; | ^~~~ Unfortunately, there is currently no better fix available that doesn't result in larger boot loader code sizes. Given the importancy of the boot loader file sizes the other fixes aren't acceptable. The Linux kernel shares the problem (but for performance reasons), take a look at the discussion https://lore.kernel.org/lkml/yt9dzgkelelc.fsf@linux.ibm.com/ for details. Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/130 Signed-off-by: Marc Hartmayer Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner --- genprotimg/boot/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/genprotimg/boot/Makefile b/genprotimg/boot/Makefile index f957a70..95bd6cc 100644 --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -15,7 +15,8 @@ ALL_CFLAGS := $(NO_PIE_CFLAGS) -Os -g \ -fno-delete-null-pointer-checks -fno-stack-protector \ -fexec-charset=IBM1047 -m64 -mpacked-stack \ -mstack-size=4096 -mstack-guard=128 -msoft-float \ - -Wall -Wformat-security -Wextra -Werror + -Wall -Wformat-security -Wextra -Werror \ + -Wno-array-bounds FILES := stage3a.bin stage3b.bin stage3b_reloc.bin -- 2.35.3