[PATCH] init: Kconfig (gcc13): disable -Warray-bounds on gcc-13 too

Jiri Slaby (SUSE) posted 1 patch 3 years, 5 months ago
init/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] init: Kconfig (gcc13): disable -Warray-bounds on gcc-13 too
Posted by Jiri Slaby (SUSE) 3 years, 5 months ago
Nobody took the chance to fix (or at least localize) the warnings since
commit f0be87c42cbd (gcc-12: disable '-Warray-bounds' universally for
now). The new compiler (gcc-13) still reports issues like:
  drivers/gpu/drm/amd/display/dc/core/dc_stream.c: In function 'dc_stream_remove_writeback':
  drivers/gpu/drm/amd/display/dc/core/dc_stream.c:531:55: error: array subscript -1 is below array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]

Note that 'j' can never be negative. So disable the warning on gcc-13
too until someone takes time to localize them.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Liska <mliska@suse.cz>
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 init/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 8fe07ab401b5..51f0fe64022d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -900,14 +900,14 @@ config CC_IMPLICIT_FALLTHROUGH
 	default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
 	default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)
 
-# Currently, disable gcc-12 array-bounds globally.
+# Currently, disable gcc-12 & 13 array-bounds globally.
 # We may want to target only particular configurations some day.
 config GCC12_NO_ARRAY_BOUNDS
 	def_bool y
 
 config CC_NO_ARRAY_BOUNDS
 	bool
-	default y if CC_IS_GCC && GCC_VERSION >= 120000 && GCC_VERSION < 130000 && GCC12_NO_ARRAY_BOUNDS
+	default y if CC_IS_GCC && GCC_VERSION >= 120000 && GCC_VERSION < 140000 && GCC12_NO_ARRAY_BOUNDS
 
 #
 # For architectures that know their GCC __int128 support is sound
-- 
2.38.1