RFR: 8295435: Build failure with GCC7 after JDK-8294314 due to strict-overflow warnings
Aleksey Shipilev
shade at openjdk.org
Tue Oct 18 15:24:02 UTC 2022
On Tue, 18 Oct 2022 02:35:59 GMT, Jie Fu <jiefu at openjdk.org> wrote:
> Hi all,
>
> Let's disable `-Werror=strict-overflow` to get it build with gcc7 on Linux/x86.
>
> bytecodeAssembler.cpp
> instanceKlass.cpp
> klassVtable.cpp
>
>
> Thanks.
> Best regards,
> Jie
My CI reports the mainline failures with GCC 6 in the following configs:
linux-x86_64-server-fastdebug
linux-aarch64-server-fastdebug
linux-arm-server-fastdebug
linux-ppc64le-server-fastdebug
linux-s390x-server-fastdebug
linux-ppc64-server-fastdebug
This PR solves part of the failures, but some require more work:
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
index 77d1ff6e21c..816eb4d9996 100644
--- a/make/hotspot/lib/CompileJvm.gmk
+++ b/make/hotspot/lib/CompileJvm.gmk
@@ -166,2 +166,3 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
DISABLED_WARNINGS_gcc_loopnode.cpp := sequence-point, \
+ DISABLED_WARNINGS_gcc_objArrayKlass.cpp := strict-overflow, \
DISABLED_WARNINGS_gcc_postaloc.cpp := address, \
Since the warning seems to be caused by the popular header, it is likely to break some other platforms/files through the different include paths from the different compilation units. The warning also looks fairly dubious, and probably is GCC bug, as it does not trigger with higher GCCs? Because of this, I suggest we add `strict-overflow` back to the global warning exclusion list:
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
index 6d4e01d1aed..534c50cc77a 100644
--- a/make/hotspot/lib/CompileJvm.gmk
+++ b/make/hotspot/lib/CompileJvm.gmk
@@ -94,6 +94,8 @@ DISABLED_WARNINGS_clang := ignored-qualifiers sometimes-uninitialized \
ifneq ($(DEBUG_LEVEL), release)
# Assert macro gives warning
DISABLED_WARNINGS_clang += tautological-constant-out-of-range-compare
+ # Some reasonable asserts produce warnings on GCC <= 7
+ DISABLED_WARNINGS_gcc += strict-overflow
endif
DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value
-------------
PR: https://git.openjdk.org/jdk/pull/10738
More information about the build-dev
mailing list