RFR: 8341178: TypeRawPtr::add_offset may be "miscompiled" due to UB [v2]
Dean Long
dlong at openjdk.org
Tue Oct 8 18:36:12 UTC 2024
On Tue, 8 Oct 2024 06:23:47 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> I saw that too, but it creates a TypePtr, not a TypeRawPtr.
>
> Oh, you are right. And TypeRawPtr::make asserts the PTR is neither Constant nor Null. Which makes
> both switch cases under modification here supposedly unreachable. That would explain why I never hit
> either after running lots of tests. All of the change proposed here can be eliminated, and instead change
> both cases to fall through to the default ShouldNotReachHere(). (And that would be another way to
> remove the -Wzero-as-null-pointer-constant warning that was how I got here in the first place. :) )
There's TypeRawPtr::make(enum PTR ptr) which doesn't allow Constant or Null, but we are using TypeRawPtr::make(address bits) here.
We may need to keep the Constant case. I wouldn't be surprised if there was a way to trigger that path using Unsafe.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21324#discussion_r1792333243
More information about the hotspot-compiler-dev
mailing list