Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

shqking
Copy link
Contributor

@shqking shqking commented Sep 22, 2022

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

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8293887: AArch64 build failure with GCC 12 due to maybe-uninitialized warning in libfdlibm k_rem_pio2.c

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

… 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
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 22, 2022

👋 Welcome back haosun! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 22, 2022
@openjdk
Copy link

openjdk bot commented Sep 22, 2022

@shqking The following labels will be automatically applied to this pull request:

  • build
  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Sep 22, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 22, 2022

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, \
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.
@openjdk
Copy link

openjdk bot commented Sep 26, 2022

@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:

8293887: AArch64 build failure with GCC 12 due to maybe-uninitialized warning in libfdlibm k_rem_pio2.c

Reviewed-by: erikj, shade, ihse

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 master branch:

  • b88ee1e: 6251738: Want a top-level summary page that itemizes all spec documents referenced from javadocs (OEM spec)
  • aca4276: 8294379: Missing comma after copyright year
  • 1f521a1: 8225012: sanity/client/SwingSet/src/ToolTipDemoTest.java fails on Windows
  • 5ae6bc2: 8234262: Unmask SIGQUIT in a child process
  • 968af74: 8293567: AbstractSplittableWithBrineGenerator: salt has digits that duplicate the marker
  • 36b61c5: 8293872: Make runtime/Thread/ThreadCountLimit.java more robust
  • 2be3158: 4797982: Setting negative size of JSplitPane divider leads to unexpected results.
  • 050eebf: 8294245: Make Compile::print_inlining_stream stack allocated
  • 91a23d7: 8294142: make test should report only on executed tests
  • 169a5d4: 8294193: Files.createDirectories throws FileAlreadyExistsException for a symbolic link whose target is an existing directory

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

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 /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 26, 2022
Copy link
Member

@shipilev shipilev left a 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.

Copy link
Member

@magicus magicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shqking
Copy link
Contributor Author

shqking commented Sep 26, 2022

Thanks for your review!
/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 26, 2022
@openjdk
Copy link

openjdk bot commented Sep 26, 2022

@shqking
Your change (at version 22355e6) is now ready to be sponsored by a Committer.

@nsjian
Copy link

nsjian commented Sep 27, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 27, 2022

Going to push as commit 02ea338.
Since your change was applied there have been 15 commits pushed to the master branch:

  • 49a7347: 8294408: Problemlist runtime/handshake/HandshakeSuspendExitTest.java
  • aa48705: 8289422: Fix and re-enable vector conditional move
  • 1ddc92f: 8294404: [BACKOUT] JDK-8294142: make test should report only executed tests
  • 1e222bc: 8293462: [macos] app image signature invalid when creating DMG or PKG from post processed signed image
  • 43eff2b: 8272687: Replace StringBuffer with StringBuilder in RuleBasedCollator
  • b88ee1e: 6251738: Want a top-level summary page that itemizes all spec documents referenced from javadocs (OEM spec)
  • aca4276: 8294379: Missing comma after copyright year
  • 1f521a1: 8225012: sanity/client/SwingSet/src/ToolTipDemoTest.java fails on Windows
  • 5ae6bc2: 8234262: Unmask SIGQUIT in a child process
  • 968af74: 8293567: AbstractSplittableWithBrineGenerator: salt has digits that duplicate the marker
  • ... and 5 more: https://git.openjdk.org/jdk/compare/3675f4c2afd10b5042948fc79e62caee5f3874ce...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 27, 2022
@openjdk openjdk bot closed this Sep 27, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 27, 2022
@openjdk
Copy link

openjdk bot commented Sep 27, 2022

@nsjian @shqking Pushed as commit 02ea338.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@shqking shqking deleted the 8293887-gcc12-fdlibm branch September 27, 2022 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

6 participants