File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -3125,8 +3125,8 @@ const TypeRawPtr *TypeRawPtr::make( enum PTR ptr ) {
31253125 return (TypeRawPtr*)(new TypeRawPtr (ptr,0 ))->hashcons ();
31263126}
31273127
3128- const TypeRawPtr *TypeRawPtr::make ( address bits ) {
3129- assert ( bits, " Use TypePtr for null" );
3128+ const TypeRawPtr *TypeRawPtr::make (address bits) {
3129+ assert (bits != nullptr , " Use TypePtr for null" );
31303130 return (TypeRawPtr*)(new TypeRawPtr (Constant,bits))->hashcons ();
31313131}
31323132
@@ -3215,15 +3215,21 @@ const TypePtr* TypeRawPtr::add_offset(intptr_t offset) const {
32153215 case TypePtr::BotPTR:
32163216 case TypePtr::NotNull:
32173217 return this ;
3218- case TypePtr::Null:
32193218 case TypePtr::Constant: {
3220- address bits = _bits+offset;
3221- if ( bits == 0 ) return TypePtr::NULL_PTR;
3222- return make ( bits );
3219+ uintptr_t bits = (uintptr_t )_bits;
3220+ uintptr_t sum = bits + offset;
3221+ if (( offset < 0 )
3222+ ? ( sum > bits ) // Underflow?
3223+ : ( sum < bits )) { // Overflow?
3224+ return BOTTOM;
3225+ } else if ( sum == 0 ) {
3226+ return TypePtr::NULL_PTR;
3227+ } else {
3228+ return make ( (address)sum );
3229+ }
32233230 }
32243231 default : ShouldNotReachHere ();
32253232 }
3226- return nullptr ; // Lint noise
32273233}
32283234
32293235// ------------------------------eq---------------------------------------------
You can’t perform that action at this time.
0 commit comments