Skip to content

Conversation

@MaxXSoft
Copy link
Member

@MaxXSoft MaxXSoft commented May 30, 2025

JDK-8350441 introduced Mapped Cache for ZGC. However, the constructor of ZMappedCache uses brace-initialization for _size_class_lists, i.e. a ZList array. ZList is a class with a deleted copy constructor and an explicit destructor, and when its array is brace-initialized in the constructor, it triggers GCC bug 63707. A short example to reproduce this bug: https://godbolt.org/z/3397bxc73

The bug causes compilation error of ZGC on GCC versions 10.1 to 10.2. Considering OpenJDK compilation is still requires GCC 10 or higher, this should be recorded as a bug.

This patch uses value-initialization for _size_class_lists instead of brace-initialization, which should be semantically equivalent and work on all GCC versions.


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-8358104: Fix ZGC compilation error on GCC 10.2 (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25536/head:pull/25536
$ git checkout pull/25536

Update a local copy of the PR:
$ git checkout pull/25536
$ git pull https://git.openjdk.org/jdk.git pull/25536/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25536

View PR using the GUI difftool:
$ git pr show -t 25536

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25536.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 30, 2025

👋 Welcome back qxing! 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
Copy link

openjdk bot commented May 30, 2025

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

8358104: Fix ZGC compilation error on GCC 10.2

Reviewed-by: kbarrett, jsikstro

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 6 new commits pushed to 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 (@kimbarrett, @jsikstro) 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 rfr Pull request is ready for review label May 30, 2025
@openjdk
Copy link

openjdk bot commented May 30, 2025

@MaxXSoft The following label will be automatically applied to this pull request:

  • hotspot-gc

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

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label May 30, 2025
@mlbridge
Copy link

mlbridge bot commented May 30, 2025

Webrevs

Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

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

The change seems okay, though a bit disappointing that it's needed.

The referenced gcc bug seems to have been fixed in gcc11, with backports to
gcc10.3 and gcc9.4. The minimum supported compiler version has always been
somewhat approximate, since there isn't regular testing reported for what are
often rather old versions. Sometimes we just decide to force an update to the
required minimum rather than working around an issue like this.

I wonder why that version is still in use?

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 30, 2025
@MaxXSoft
Copy link
Member Author

@kimbarrett Thanks for your review!

I wonder why that version is still in use?

My development environment is an Alibaba Cloud ECS server, with Alibaba Cloud Linux 3.2104 LTS. The default C++ compiler in this OS happens to be GCC 10.2.1.

@MaxXSoft
Copy link
Member Author

@jsikstro Thanks for your review!

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label May 30, 2025
@openjdk
Copy link

openjdk bot commented May 30, 2025

@MaxXSoft
Your change (at version 1234f07) is now ready to be sponsored by a Committer.

@jsikstro
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented May 30, 2025

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 30, 2025
@openjdk openjdk bot closed this May 30, 2025
@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 May 30, 2025
@openjdk
Copy link

openjdk bot commented May 30, 2025

@jsikstro @MaxXSoft Pushed as commit a0eb190.

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

@MaxXSoft MaxXSoft deleted the fix-zgc-compile-error branch May 30, 2025 09:41
@jsikstro
Copy link
Member

Thanks for the fix @MaxXSoft! Just FYI, we usually allow PRs to be open for at least 24 hours to make sure reviewers from different time zones have a chance to see a PR, but this is a very small change. I'm not sure it was my place (seeing I'm only a Commiter and not a Reviewer) to say this is trivial, but I'd strongly argue it is.

https://openjdk.org/guide/index.html#life-of-a-pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants