[11u]RFR[S]:8240715: fail to build with gcc 6.3.1 [-Werror=maybe-uninitialized]

David Holmes david.holmes at oracle.com
Mon Mar 9 09:19:35 UTC 2020


They look like false-positives flagged by gcc 6.3.1. IIRC these are not 
flagged in later gcc versions and it was decided not to "fix" them.

David

On 9/03/2020 7:15 pm, Langer, Christoph wrote:
> Hi Lin,
> 
> I compared the coding that you touch to the current versions in head and the code there seems quite the same or at least similar in regards to the possible warnings.
> 
> I rather suggest you do the change in jdk/jdk first and we'd then backport it? Or is there anything which speaks against doing this in head?
> 
> Cheers
> Christoph
> 
> 
> -----Original Message-----
> From: jdk-updates-dev <jdk-updates-dev-bounces at openjdk.java.net> On Behalf Of linzang(??)
> Sent: Sonntag, 8. März 2020 09:23
> To: jdk-updates-dev at openjdk.java.net
> Subject: Re: [11u]RFR[S]:8240715: fail to build with gcc 6.3.1 [-Werror=maybe-uninitialized]
> 
> I made a tiny patch for this:
> Please help to review.
> Webrev: http://cr.openjdk.java.net/~lzang/11u/JDK-8240715/webrev/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8240715
> 
> 
> BRs,
> Lin
> 
> From: "linzang(臧琳)" <linzang at tencent.com>
> Date: Saturday, March 7, 2020 at 12:33 AM
> To: "jdk-updates-dev at openjdk.java.net" <jdk-updates-dev at openjdk.java.net>
> Subject: [11u] fail to build with gcc 6.3.1 [-Werror=maybe-uninitialized]
> 
> 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