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

Thomas Stuefe stuefe at openjdk.org
Mon Aug 1 19:35:25 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
>  - [ ] Linux x86_64 fastdebug tier1 with GCC 9.3.0

LGTM

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

Marked as reviewed by stuefe (Reviewer).

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


More information about the shenandoah-dev mailing list