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

Aleksey Shipilev shade at openjdk.org
Wed Aug 3 08:50:08 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, GCC 11.2.1
>  - [x] Linux x86_64 fastdebug tier1 with GCC 9.3.0

Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Copyright years
 - Merge branch 'master' into JDK-8291633-alpine3-nullptr
 - More work
 - Fix

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9705/files
  - new: https://git.openjdk.org/jdk/pull/9705/files/59f92b41..3d3dbc3c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9705&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9705&range=00-01

  Stats: 1075 lines in 48 files changed: 648 ins; 260 del; 167 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