RFR: 8341178: TypeRawPtr::add_offset may be "miscompiled" due to UB [v2]

Dean Long dlong at openjdk.org
Mon Oct 7 22:08:35 UTC 2024


On Mon, 7 Oct 2024 21:45:31 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> src/hotspot/share/opto/type.cpp line 3226:
>> 
>>> 3224:     return this;
>>> 3225:   case TypePtr::Null:
>>> 3226:     return make( (address)offset );
>> 
>> Shouldn't this assert that _bits == 0?  Looking at the code, however, I can't find anywhere that we actually create a TypeRawPtr with TypePtr::Null.  We could probably remove this case and let it fall through to the default ShouldNotReachHere().
>
> Initialization of `TypePtr::NULL_PTR` here:
> https://github.com/openjdk/jdk/blob/4d50cbb5a73ad1f84ecd6a895045ecfdb0835adc/src/hotspot/share/opto/type.cpp#L538

I saw that too, but it creates a TypePtr, not a TypeRawPtr.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21324#discussion_r1790935162


More information about the hotspot-compiler-dev mailing list