Integrated: 8335298: Fix -Wzero-as-null-pointer-constant warning in G1CardSetContainers

Kim Barrett kbarrett at openjdk.org
Tue Jul 2 09:01:23 UTC 2024


On Sat, 29 Jun 2024 01:01:06 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to the G1CardSetInlinePtr default constructor to
> avoid -Wzero-as-null-pointer-constant.  The problem is that it is casting a
> constant 0 to a pointer.  Because casting 0 to a pointer is what this code
> needs to do, the options are to (1) suppress the warning, or (2) write the
> code in such a way as to dodge the warning.  We take the latter approach, as
> it involves less source code clutter.  We expect an optimizing compiler to
> produce the same code either way.
> 
> Also simplified the constructors by using delegation.
> 
> Testing: mach5 tier1.
> Locally (linux-x64) verified the warning no longer occurs with this change.

This pull request has now been integrated.

Changeset: 4060b35b
Author:    Kim Barrett <kbarrett at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/4060b35b1d00fccbec4b20353063f77c43ecc686
Stats:     16 lines in 1 file changed: 11 ins; 1 del; 4 mod

8335298: Fix -Wzero-as-null-pointer-constant warning in G1CardSetContainers

Reviewed-by: iwalulya, ayang

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

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


More information about the hotspot-gc-dev mailing list