From: Zhouyi Zhou <zhouzhouyi@gmail.com>
To: akpm@linux-foundation.org, pmladek@suse.com,
masahiroy@kernel.org, yoann.congal@smile.fr,
rdunlap@infradead.org, gustavoars@kernel.org, nphamcs@gmail.com,
vincent.guittot@linaro.org, linux-kernel@vger.kernel.org,
rcu@vger.kernel.org
Cc: Zhouyi Zhou <zhouzhouyi@gmail.com>
Subject: [PATCH] init/Kconfig: lower to GCC version 9 check for -Warray-bounds
Date: Sat, 8 Jun 2024 01:40:27 +0000 [thread overview]
Message-ID: <20240608014027.1118686-1-zhouzhouyi@gmail.com> (raw)
commit 3e00f5802fab ("init/Kconfig: lower GCC version check for -Warray-bounds")
lowers GCC version check for -Warray-bounds, but I continue to see false positives
from -Warray-bounds in GCC 9.4.
This happens after
commit b44759705f7d ("bitmap: make bitmap_{get,set}_value8() use bitmap_{read,write}()")
During the rcuturture test in Ubuntu 20.04 GCC 9.4.0 x86_64, the compiling of
drivers/gpio/gpio-pca953x.c issues following warning:
```
CC drivers/gpio/gpio-pca953x.o
In file included from drivers/gpio/gpio-pca953x.c:12:
drivers/gpio/gpio-pca953x.c: In function ‘pca953x_probe’:
./include/linux/bitmap.h:799:17: error: array subscript [1, 1024] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
799 | map[index + 1] &= BITMAP_FIRST_WORD_MASK(start + nbits);
| ^~
In file included from ./include/linux/atomic.h:5,
from drivers/gpio/gpio-pca953x.c:11:
drivers/gpio/gpio-pca953x.c:1015:17: note: while referencing ‘val’
1015 | DECLARE_BITMAP(val, MAX_LINE);
| ^~~
./include/linux/types.h:11:16: note: in definition of macro ‘DECLARE_BITMAP’
11 | unsigned long name[BITS_TO_LONGS(bits)]
| ^~~~
In file included from drivers/gpio/gpio-pca953x.c:12:
./include/linux/bitmap.h:800:17: error: array subscript [1, 1024] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
800 | map[index + 1] |= (value >> space);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/atomic.h:5,
from drivers/gpio/gpio-pca953x.c:11:
drivers/gpio/gpio-pca953x.c:1015:17: note: while referencing ‘val’
1015 | DECLARE_BITMAP(val, MAX_LINE);
| ^~~
./include/linux/types.h:11:16: note: in definition of macro ‘DECLARE_BITMAP’
11 | unsigned long name[BITS_TO_LONGS(bits)]
```
Disable gcc-9+ array-bounds avoid above warning.
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
---
init/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/init/Kconfig b/init/Kconfig
index 72404c1f2157..27ce2ded95b6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -876,14 +876,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-10+ array-bounds globally.
+# Currently, disable gcc-9+ array-bounds globally.
# It's still broken in gcc-13, so no upper bound yet.
-config GCC10_NO_ARRAY_BOUNDS
+config GCC9_NO_ARRAY_BOUNDS
def_bool y
config CC_NO_ARRAY_BOUNDS
bool
- default y if CC_IS_GCC && GCC_VERSION >= 100000 && GCC10_NO_ARRAY_BOUNDS
+ default y if CC_IS_GCC && GCC_VERSION >= 90000 && GCC9_NO_ARRAY_BOUNDS
# Currently, disable -Wstringop-overflow for GCC globally.
config GCC_NO_STRINGOP_OVERFLOW
--
2.25.1
next reply other threads:[~2024-06-08 1:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 1:40 Zhouyi Zhou [this message]
2024-06-09 0:31 ` Zhouyi Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240608014027.1118686-1-zhouzhouyi@gmail.com \
--to=zhouzhouyi@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gustavoars@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nphamcs@gmail.com \
--cc=pmladek@suse.com \
--cc=rcu@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=vincent.guittot@linaro.org \
--cc=yoann.congal@smile.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®