From: =?UTF-8?q?Martin=20Li=C5=A1ka?= Date: Tue, 22 Mar 2022 10:52:19 +0100 Subject: Silence GCC 12 spurious warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-commit: 0000000000000000000000000000000000000000 References: bsc#1197018 With GCC 12, build fails like this: [ 6245s] inlined from 'memcpy_user' at arch/x86/include/librm.h:155:2, [ 6245s] inlined from 'copy_from_user' at include/ipxe/uaccess.h:338:2, [ 6245s] inlined from 'acpi_sx_zsdt' at core/acpi.c:217:3: [ 6245s] arch/x86/include/bits/string.h:79:32: error: array subscript 'union [0]' is partly outside array bounds of 'union [1]' [-Werror=array-bounds] [ 6245s] 79 | dest_u->u32[0] = src_u->u32[0]; [ 6245s] | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ [ 6245s] core/acpi.c: In function 'acpi_sx_zsdt': [ 6245s] core/acpi.c:191:11: note: object 'buf' of size 4 [ 6245s] 191 | } buf; [ 6245s] | ^~~ Which is a false positive reported by GCC compiler: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98503 Silence the watning. Signed-off-by: Martin Liška Signed-off-by: Dario Faggioli --- src/Makefile.housekeeping | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/roms/ipxe/src/Makefile.housekeeping b/roms/ipxe/src/Makefile.housekeeping index 36cfb950e014914232f254b7edbb..cad327d31dbe0bd69d956c32d28d 100644 --- a/roms/ipxe/src/Makefile.housekeeping +++ b/roms/ipxe/src/Makefile.housekeeping @@ -183,6 +183,19 @@ WNAPM_TEST = $(CC) -Wno-address-of-packed-member -x c -c /dev/null \ WNAPM_FLAGS := $(shell $(WNAPM_TEST) && \ $(ECHO) '-Wno-address-of-packed-member') WORKAROUND_CFLAGS += $(WNAPM_FLAGS) + +# gcc 12.1 generates false positive warnings. Inhibit the warnings. +WNAB_TEST = $(CC) -Wno-array-bounds -x c -c /dev/null \ + -o /dev/null >/dev/null 2>&1 +WNAB_FLAGS := $(shell $(WNAB_TEST) && \ + $(ECHO) '-Wno-array-bounds') +WORKAROUND_CFLAGS += $(WNAB_FLAGS) + +WNDP_TEST = $(CC) -Wno-dangling-pointer-x c -c /dev/null \ + -o /dev/null >/dev/null 2>&1 +WNDP_FLAGS := $(shell $(WNAB_TEST) && \ + $(ECHO) '-Wno-dangling-pointer') +WORKAROUND_CFLAGS += $(WNDP_FLAGS) endif # Some versions of gas choke on division operators, treating them as