[11u] fail to build with gcc 6.3.1 [-Werror=maybe-uninitialized]
linzang(臧琳)
linzang at tencent.com
Fri Mar 6 16:33:10 UTC 2020
Hi,
The 11u-dev repo fail to build with gcc 6.3.1, error message:
====================================================
In file included from / Source/jdk11u-dev/src/hotspot/cpu/x86/assembler_x86.inline.hpp:30:0,
from / Source/jdk11u-dev/src/hotspot/share/asm/assembler.inline.hpp:30,
from / Source/jdk11u-dev/src/hotspot/share/precompiled/precompiled.hpp:32:
/Source/jdk11u-dev/src/hotspot/share/code/codeCache.hpp: In member function 'void G1CollectedHeap::complete_cleaning(BoolObjectClosure*, bool)':
/Source/jdk11u-dev/src/hotspot/share/code/codeCache.hpp:377:5: error: 'iter.CodeBlobIterator<CompiledMethod, CompiledMethodFilter>::_code_blob' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (_code_blob == NULL) {
^~
/Source/jdk11u-dev/src/hotspot/share/gc/g1/g1CollectedHeap.cpp:3355:28: note: 'iter.CodeBlobIterator<CompiledMethod, CompiledMethodFilter>::_code_blob' was declared here
CompiledMethodIterator iter = CompiledMethodIterator();
^~~~
cc1plus: all warnings being treated as errors
The build can success with –disable-warnings-as-errors or with simple change:
diff -r e5802f7424cf src/hotspot/share/code/codeCache.hpp
--- a/src/hotspot/share/code/codeCache.hpp Fri May 24 13:52:33 2019 -0700
+++ b/src/hotspot/share/code/codeCache.hpp Fri Mar 06 15:00:55 2020 +0800
@@ -322,6 +322,7 @@
public:
CodeBlobIterator(T* nm = NULL) {
+ _code_blob = NULL;
if (Filter::heaps() == NULL) {
return;
}
diff -r e5802f7424cf src/hotspot/share/gc/shared/genCollectedHeap.cpp
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp Fri May 24 13:52:33 2019 -0700
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp Fri Mar 06 15:00:55 2020 +0800
@@ -1146,6 +1146,7 @@
size_t min_size = 0; // "first" makes this conceptually infinite.
ScratchBlock **smallest_ptr, *smallest;
ScratchBlock *cur = *prev_ptr;
+ smallest_ptr = NULL;
while (cur) {
assert(*prev_ptr == cur, "just checking");
if (first || cur->num_words < min_size) {
-----------------------------------------------------------
So could this be a fix ?
BRs,
Lin
More information about the jdk-updates-dev
mailing list