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

Aleksey Shipilev shade at openjdk.org
Mon Aug 1 17:09:44 UTC 2022


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
 - [ ] Linux x86_64 fastdebug tier1 with GCC 9.3.0

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

Commit messages:
 - More work
 - Fix

Changes: https://git.openjdk.org/jdk/pull/9705/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9705&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8291633
  Stats: 15 lines in 6 files changed: 0 ins; 0 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/9705.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9705/head:pull/9705

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


More information about the shenandoah-dev mailing list