RFR: 8345273: Fix -Wzero-as-null-pointer-constant warnings in s390 code

Kim Barrett kbarrett at openjdk.org
Wed Dec 4 13:05:37 UTC 2024


On Sun, 1 Dec 2024 16:23:35 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to remove -Wzero-as-null-pointer-constant warnings
> in s390 code.
> 
> Most places involve just changing literal 0 to nullptr.
> 
> Removed a dead return after ShouldNotReachHere() that is no longer needed.
> 
> Testing:
> GHA sanity test build, with and without -Wzero-as-null-pointer-constant enabled.
> I don't have the capability to run tests for this platform, so hoping someone
> from the aix-ppc maintainers can do more testing.

> hi @kimbarrett,
> 
> I tried to build it on s390x with these changes:
> 
> ```diff
> diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
> index 57654514eb6..ce3077e7d38 100644
> --- a/make/autoconf/flags-cflags.m4
> +++ b/make/autoconf/flags-cflags.m4
> ```
[snip]
> is that correct way to test it ?

That's too general, affecting the entire JDK. The rule we're trying to enforce
(don't use literal 0 as a null pointer constant) is specific to HotSpot.

For testing, I've been adding the warning to the list here:

https://github.com/openjdk/jdk/blob/e13206d3a16a67a604076faecded88cbed85db1a/make/autoconf/flags-cflags.m4#L785

I've not verified with the build team that this is the right place ultimately.
And I suspect it's not, since your log listed warnings in adlc. I'm not seeing
any warnings there, even though (looking at the code) there clearly should be.

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

PR Comment: https://git.openjdk.org/jdk/pull/22469#issuecomment-2517290216


More information about the hotspot-dev mailing list