Skip to content

Commit 0da6e5f

Browse files
committed
gcc: disable '-Warray-bounds' for gcc-13 too
We started disabling '-Warray-bounds' for gcc-12 originally on s390, because it resulted in some warnings that weren't realistically fixable (commit 8b202ee: "s390: disable -Warray-bounds"). That s390-specific issue was then found to be less common elsewhere, but generic (see f0be87c: "gcc-12: disable '-Warray-bounds' universally for now"), and then later expanded the version check was expanded to gcc-11 (5a41237: "gcc: disable -Warray-bounds for gcc-11 too"). And it turns out that I was much too optimistic in thinking that it's all going to go away, and here we are with gcc-13 showing all the same issues. So instead of expanding this one version at a time, let's just disable it for gcc-11+, and put an end limit to it only when we actually find a solution. Yes, I'm sure some of this is because the kernel just does odd things (like our "container_of()" use, but also knowingly playing games with things like linker tables and array layouts). And yes, some of the warnings are likely signs of real bugs, but when there are hundreds of false positives, that doesn't really help. Oh well. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8296ac9 commit 0da6e5f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

init/Kconfig

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -890,18 +890,14 @@ config CC_IMPLICIT_FALLTHROUGH
890890
default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
891891
default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)
892892

893-
# Currently, disable gcc-11,12 array-bounds globally.
894-
# We may want to target only particular configurations some day.
893+
# Currently, disable gcc-11+ array-bounds globally.
894+
# It's still broken in gcc-13, so no upper bound yet.
895895
config GCC11_NO_ARRAY_BOUNDS
896896
def_bool y
897897

898-
config GCC12_NO_ARRAY_BOUNDS
899-
def_bool y
900-
901898
config CC_NO_ARRAY_BOUNDS
902899
bool
903-
default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_ARRAY_BOUNDS
904-
default y if CC_IS_GCC && GCC_VERSION >= 120000 && GCC_VERSION < 130000 && GCC12_NO_ARRAY_BOUNDS
900+
default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS
905901

906902
#
907903
# For architectures that know their GCC __int128 support is sound

0 commit comments

Comments
 (0)