-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8293887: AArch64 build failure with GCC 12 due to maybe-uninitialized warning in libfdlibm k_rem_pio2.c #10386
Conversation
… warning in libfdlibm k_rem_pio2.c 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
👋 Welcome back haosun! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -48,7 +48,8 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \ | |||
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \ | |||
CFLAGS_windows_debug := -DLOGGING, \ | |||
CFLAGS_aix := -qfloat=nomaf, \ | |||
DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \ | |||
DISABLED_WARNINGS_gcc := sign-compare misleading-indentation \ | |||
array-bounds maybe-uninitialized, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this would be better:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
write(foo, bar, baz);
#pragma GCC diagnostic pop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should not modify 3rd party code.
What you would need is JDK-8294281. If you can hold back this patch for a little while, you'll be able to utilize it instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your info @magicus.
Updated the code using JDK-8294281 in the latest commit.
Would you mind taking another look? Thanks! @theRealAph @magicus
After JDK-8294281, we can disable the warning options per file. Testing: Release builds with GCC 9, GCC 11 and GCC 12 passed on Ubuntu 22.04/AArch64 system.
@shqking This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 10 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@erikj79, @shipilev, @magicus) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for your review! |
/sponsor |
Going to push as commit 02ea338.
Your commit was automatically rebased without conflicts. |
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
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10386/head:pull/10386
$ git checkout pull/10386
Update a local copy of the PR:
$ git checkout pull/10386
$ git pull https://git.openjdk.org/jdk pull/10386/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10386
View PR using the GUI difftool:
$ git pr show -t 10386
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10386.diff