@@ -200,37 +200,28 @@ class Pointer {
200200 if (isZero () || isUnknownSizeArray ())
201201 return *this ;
202202
203+ unsigned Base = asBlockPointer ().Base ;
203204 // Pointer to an array of base types - enter block.
204- if (asBlockPointer (). Base == RootPtrMark)
205+ if (Base == RootPtrMark)
205206 return Pointer (asBlockPointer ().Pointee , sizeof (InlineDescriptor),
206207 Offset == 0 ? Offset : PastEndMark);
207208
208209 // Pointer is one past end - magic offset marks that.
209210 if (isOnePastEnd ())
210- return Pointer (asBlockPointer ().Pointee , asBlockPointer ().Base ,
211- PastEndMark);
212-
213- // Primitive arrays are a bit special since they do not have inline
214- // descriptors. If Offset != Base, then the pointer already points to
215- // an element and there is nothing to do. Otherwise, the pointer is
216- // adjusted to the first element of the array.
217- if (inPrimitiveArray ()) {
218- if (Offset != asBlockPointer ().Base )
211+ return Pointer (asBlockPointer ().Pointee , Base, PastEndMark);
212+
213+ if (Offset != Base) {
214+ // If we're pointing to a primitive array element, there's nothing to do.
215+ if (inPrimitiveArray ())
219216 return *this ;
220- return Pointer (asBlockPointer ().Pointee , asBlockPointer ().Base ,
221- Offset + sizeof (InitMapPtr));
217+ // Pointer is to a composite array element - enter it.
218+ if (Offset != Base)
219+ return Pointer (asBlockPointer ().Pointee , Offset, Offset);
222220 }
223221
224- // Pointer is to a field or array element - enter it.
225- if (Offset != asBlockPointer ().Base )
226- return Pointer (asBlockPointer ().Pointee , Offset, Offset);
227-
228- // Enter the first element of an array.
229- if (!getFieldDesc ()->isArray ())
230- return *this ;
231-
232- const unsigned NewBase = asBlockPointer ().Base + sizeof (InlineDescriptor);
233- return Pointer (asBlockPointer ().Pointee , NewBase, NewBase);
222+ // Otherwise, we're pointing to a non-array element or
223+ // are already narrowed to a composite array element. Nothing to do.
224+ return *this ;
234225 }
235226
236227 // / Expands a pointer to the containing array, undoing narrowing.
0 commit comments