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

Kim Barrett kbarrett at openjdk.org
Mon Oct 7 22:01:27 UTC 2024


On Mon, 7 Oct 2024 21:27:58 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   remove surrounding whitespace
>
> 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

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

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


More information about the hotspot-compiler-dev mailing list