On Thu, 22 Sep 2022 07:02:16 GMT, Hao Sun <hao...@openjdk.org> wrote:

> This warning seems to be a false positive, because 1) array "fq" with 
> elements from index 0 to "jz" has already been initialized as "fw" at line 
> 290 [1], and 2) variable "jz" should be non-negative from the comment at line 
> 99 [2].
> 
> Note-1: GCC warning option -Wmaybe-uninitialized is not a new one. Note-2: 
> x86-64 build with GCC 12 on Ubuntu 22.04 passed in my local test.
> 
> This warning is raised only on GCC 12 + AArch64. I suspect it might be some 
> GCC 12 bug, so I reported it to GCC community [3].
> 
> Since it involves third party code, I think it's better to suppress the 
> warning by simply disabling this warning option in the makefile.
> 
> Testing: Release builds with GCC 9, GCC 11 and GCC 12 passed on Ubuntu 
> 22.04/AArch64 system.
> 
> [1] 
> https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libfdlibm/k_rem_pio2.c#L290
>  
> [2] 
> https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libfdlibm/k_rem_pio2.c#L99
>  
> [3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106992

make/modules/java.base/lib/CoreLibraries.gmk line 52:

> 50:     CFLAGS_aix := -qfloat=nomaf, \
> 51:     DISABLED_WARNINGS_gcc := sign-compare misleading-indentation \
> 52:         array-bounds maybe-uninitialized, \

Something like this would be better:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
    write(foo, bar, baz);
#pragma GCC diagnostic pop

-------------

PR: https://git.openjdk.org/jdk/pull/10386

Reply via email to