RFR: 8332697: ubsan: shenandoahSimpleBitMap.inline.hpp:68:23: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int'

Henry Lin duke at openjdk.org
Fri Jul 19 21:30:01 UTC 2024


Cast the result of `nth_bit(n)` to `uintptr_t` to prevent signed integer overflow error reported by `ubsan`. Unsigned overflow is not undefined behavior and is not checked by `ubsan`.

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

Commit messages:
 - 8332697: fix ubsan:shenandoahSimpleBitMap.inline.hpp runtime integer overflow

Changes: https://git.openjdk.org/jdk/pull/20164/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20164&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8332697
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/20164.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20164/head:pull/20164

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


More information about the hotspot-dev mailing list