RFR: 8293887: AArch64 build failure with GCC 12 due to maybe-uninitialized warning in libfdlibm k_rem_pio2.c
Hao Sun
haosun at openjdk.org
Fri Sep 23 07:00:14 UTC 2022
On Thu, 22 Sep 2022 09:35:47 GMT, Andrew Haley <aph at 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
Thanks for your review.
Your mentioned solution should work and we can also enable the pragma only for aarch64 + gcc>=12 condition.
I considered such a solution when preparing this patch.
But I personally prefer to suppress the waring in the makefile, mainly because fdlibm is 3rd party library and we'd better not changing the source code. I think it is a long-standing policy.
-------------
PR: https://git.openjdk.org/jdk/pull/10386
More information about the build-dev
mailing list