@@ -1568,10 +1568,20 @@ inline bool GetPtrActiveThisField(InterpState &S, CodePtr OpPC, uint32_t Off) {
15681568 return true ;
15691569}
15701570
1571- inline bool GetPtrDerivedPop (InterpState &S, CodePtr OpPC, uint32_t Off) {
1571+ inline bool GetPtrDerivedPop (InterpState &S, CodePtr OpPC, uint32_t Off,
1572+ bool NullOK) {
15721573 const Pointer &Ptr = S.Stk .pop <Pointer>();
1573- if (!CheckNull (S, OpPC, Ptr, CSK_Derived))
1574+ if (!NullOK && ! CheckNull (S, OpPC, Ptr, CSK_Derived))
15741575 return false ;
1576+
1577+ if (!Ptr.isBlockPointer ()) {
1578+ // FIXME: We don't have the necessary information in integral pointers.
1579+ // The Descriptor only has a record, but that does of course not include
1580+ // the potential derived classes of said record.
1581+ S.Stk .push <Pointer>(Ptr);
1582+ return true ;
1583+ }
1584+
15751585 if (!CheckSubobject (S, OpPC, Ptr, CSK_Derived))
15761586 return false ;
15771587 if (!CheckDowncast (S, OpPC, Ptr, Off))
@@ -1600,10 +1610,11 @@ inline bool GetPtrBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
16001610 return true ;
16011611}
16021612
1603- inline bool GetPtrBasePop (InterpState &S, CodePtr OpPC, uint32_t Off) {
1613+ inline bool GetPtrBasePop (InterpState &S, CodePtr OpPC, uint32_t Off,
1614+ bool NullOK) {
16041615 const Pointer &Ptr = S.Stk .pop <Pointer>();
16051616
1606- if (!CheckNull (S, OpPC, Ptr, CSK_Base))
1617+ if (!NullOK && ! CheckNull (S, OpPC, Ptr, CSK_Base))
16071618 return false ;
16081619
16091620 if (!Ptr.isBlockPointer ()) {
0 commit comments