Integrated: 8358104: Fix ZGC compilation error on GCC 10.2

Qizheng Xing qxing at openjdk.org
Fri May 30 09:43:58 UTC 2025


On Fri, 30 May 2025 02:40:48 GMT, Qizheng Xing <qxing at openjdk.org> wrote:

> 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](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=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.

This pull request has now been integrated.

Changeset: a0eb1900
Author:    Qizheng Xing <qxing at openjdk.org>
Committer: Joel Sikström <jsikstro at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/a0eb1900c91531db26d1086a3b251bce0cf7c141
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

8358104: Fix ZGC compilation error on GCC 10.2

Reviewed-by: kbarrett, jsikstro

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

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


More information about the hotspot-gc-dev mailing list