RFR: 8345016: [ASAN] java.c false positive ‘%s’ directive argument is null [-Werror=format-truncation=] [v2]
SendaoYan
syan at openjdk.org
Wed Dec 4 16:04:01 UTC 2024
> Hi all,
> The file src/java.base/share/native/libjli/java.c generate false positive compile warning by gcc14 with gcc options `-fsanitize=undefined -O2`, and make jdk build error when configure with option `--enable-asan`. So I think it's necessory to disable the false positive compile warning to make jdk build normally with configure option `--enable-asan`.
> This PR use gcc `_Pragma` to disbale the `-Wformat-truncation` compile warning, to make the disable code area as small as possible, and make the change looks ugly. There is another solution to disable the compile warning seen as below, but it will disable the compile warning of java.c. So I use the first solution.
>
>
> diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk
> index 61ac495968a..5bc83cf0978 100644
> --- a/make/modules/java.base/lib/CoreLibraries.gmk
> +++ b/make/modules/java.base/lib/CoreLibraries.gmk
> @@ -178,6 +178,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
> OPTIMIZATION := HIGH, \
> CFLAGS := $(LIBJLI_CFLAGS) $(LIBZ_CFLAGS), \
> DISABLED_WARNINGS_gcc := unused-function unused-variable, \
> + DISABLED_WARNINGS_gcc_java.c := format-truncation, \
> DISABLED_WARNINGS_clang := deprecated-non-prototype format-nonliteral \
> unused-function, \
> DISABLED_WARNINGS_clang_java_md_macosx.m := unused-variable, \
SendaoYan has updated the pull request incrementally with one additional commit since the last revision:
Fix compile warning C4068: unknown pragma 'GCC' on windows
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22546/files
- new: https://git.openjdk.org/jdk/pull/22546/files/aa7b541d..1ca177ca
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22546&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22546&range=00-01
Stats: 6 lines in 1 file changed: 4 ins; 2 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/22546.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22546/head:pull/22546
PR: https://git.openjdk.org/jdk/pull/22546
More information about the core-libs-dev
mailing list