JDK-8241018 : 32-bit integer log2 functions return the wrong value for negative arguments on 64-bit machines
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: openjdk8u212,11.0.3,14,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-03-13
  • Updated: 2020-03-24
  • Resolved: 2020-03-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b15Fixed
Related Reports
Relates :  
Description
log2_int() should return 32 for all negative arguments: the intention is to find the most significant set bit in x.

This does not work on 64-bit machines because the argument is sign extended to 64 bits before being converted to uintptr_t.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/a4e2fc916323 User: aph Date: 2020-03-17 14:23:10 +0000
18-03-2020

The affected lines were added by JDK-8213419, which is in 8u and 11u as well.
18-03-2020

ILW = MLM = P4
17-03-2020