JDK-8276563 : Undefined Behaviour in class Assembler
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,11,17,18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-11-03
  • Updated: 2024-02-06
  • Resolved: 2022-01-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 19
19 b06Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
All instances of type Register exhibit UB in the form of wild pointer (including null pointer) dereferences. This isn't very hard to fix: we should make Registers pointers to something rather than aliases of small integers.
Comments
Changeset: 64c0c0e1 Author: Andrew Haley <aph@openjdk.org> Date: 2022-01-18 15:27:18 +0000 URL: https://git.openjdk.java.net/jdk/commit/64c0c0e109f9853072f1d306fef1a2e31568ec9e
18-01-2022

Hi [~aph], just wanted to give you a heads-up that the fork is coming up next Thursday and this bug needs to be integrated before that to get it into 18 (as it's a P4). As the review seems more or less completed I assume that you are going to integrate it into 18?
01-12-2021

ILW = Undefined behavior in assembler (potential crash etc.) and not a recent regression, never observed, no workaround = MLH = P4
04-11-2021

It's always been like this as far as I'm aware, and I'm surprised we got away from it for so long. I have a prototype that makes Registers point to something real. This does mean that Register::encoding() has to do some work (rather than just returning this) but it is a trivial subtraction of a PC-relative constant.
03-11-2021