Integrated: 8291633: Build failures with GCC 11, Alpine 3 due to incompatible casts from nullptr

Aleksey Shipilev shade at openjdk.org
Wed Aug 3 17:26:34 UTC 2022


On Mon, 1 Aug 2022 17:01:51 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Looks like GCC and musl that ship in new Alpine 3.15 highlight that some casts from `NULL` and `nullptr` are risky/illegal. 
> 
> They fall into three categories:
>   - explicitly casting `NULL` to integral type; we can and should use `NULL_WORD` in these cases, like the rest of Hotspot does;
>   - using `NULL` in ternary expression when another side is integral type, thus implicitly casting it;
>   - `reinterpret_cast`-ing `NULL` to pointer type -- this is dangerous and rightfully breaks; we can use `static_cast` instead.
> 
> Additional testing:
>  - [x] Linux x86_64 {release, fastdebug, slowdebug} build with Alpine 3.15, GCC 11.2.1
>  - [x] Linux x86_64 fastdebug tier1 with GCC 9.3.0

This pull request has now been integrated.

Changeset: c89556f6
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/c89556f6cd4d0b64f3e9e2f1dc7c51634522f205
Stats:     16 lines in 6 files changed: 0 ins; 0 del; 16 mod

8291633: Build failures with GCC 11, Alpine 3 due to incompatible casts from nullptr

Reviewed-by: stuefe, mbaesken, jiefu

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

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


More information about the shenandoah-dev mailing list