File tree 1 file changed +13
-7
lines changed
1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -3111,8 +3111,8 @@ const TypeRawPtr *TypeRawPtr::make( enum PTR ptr ) {
3111
3111
return (TypeRawPtr*)(new TypeRawPtr (ptr,nullptr ))->hashcons ();
3112
3112
}
3113
3113
3114
- const TypeRawPtr *TypeRawPtr::make ( address bits ) {
3115
- assert ( bits, " Use TypePtr for null" );
3114
+ const TypeRawPtr *TypeRawPtr::make (address bits) {
3115
+ assert (bits != nullptr , " Use TypePtr for null" );
3116
3116
return (TypeRawPtr*)(new TypeRawPtr (Constant,bits))->hashcons ();
3117
3117
}
3118
3118
@@ -3201,15 +3201,21 @@ const TypePtr* TypeRawPtr::add_offset(intptr_t offset) const {
3201
3201
case TypePtr::BotPTR:
3202
3202
case TypePtr::NotNull:
3203
3203
return this ;
3204
- case TypePtr::Null:
3205
3204
case TypePtr::Constant: {
3206
- address bits = _bits+offset;
3207
- if ( bits == 0 ) return TypePtr::NULL_PTR;
3208
- return make ( bits );
3205
+ uintptr_t bits = (uintptr_t )_bits;
3206
+ uintptr_t sum = bits + offset;
3207
+ if (( offset < 0 )
3208
+ ? ( sum > bits ) // Underflow?
3209
+ : ( sum < bits )) { // Overflow?
3210
+ return BOTTOM;
3211
+ } else if ( sum == 0 ) {
3212
+ return TypePtr::NULL_PTR;
3213
+ } else {
3214
+ return make ( (address)sum );
3215
+ }
3209
3216
}
3210
3217
default : ShouldNotReachHere ();
3211
3218
}
3212
- return nullptr ; // Lint noise
3213
3219
}
3214
3220
3215
3221
// ------------------------------eq---------------------------------------------
You can’t perform that action at this time.
1 commit comments
openjdk-notifier[bot] commentedon Oct 11, 2024
Review
Issues