@@ -296,7 +296,7 @@ static bool interp__builtin_strcmp(InterpState &S, CodePtr OpPC,
296296static bool interp__builtin_strlen (InterpState &S, CodePtr OpPC,
297297 const InterpFrame *Frame,
298298 const CallExpr *Call, unsigned ID) {
299- const Pointer &StrPtr = S.Stk .pop <Pointer>();
299+ const Pointer &StrPtr = S.Stk .pop <Pointer>(). expand () ;
300300
301301 if (ID == Builtin::BIstrlen || ID == Builtin::BIwcslen)
302302 diagnoseNonConstexprBuiltin (S, OpPC, ID);
@@ -1439,7 +1439,7 @@ static bool interp__builtin_operator_new(InterpState &S, CodePtr OpPC,
14391439 Allocator.allocate (Desc, NumElems.getZExtValue (), S.Ctx .getEvalID (),
14401440 DynamicAllocator::Form::Operator);
14411441 assert (B);
1442- S.Stk .push <Pointer>(Pointer (B).atIndex (0 ));
1442+ S.Stk .push <Pointer>(Pointer (B).atIndex (0 ). narrow () );
14431443 return true ;
14441444 }
14451445
@@ -1763,8 +1763,8 @@ static bool interp__builtin_memcpy(InterpState &S, CodePtr OpPC,
17631763 assert (Call->getNumArgs () == 3 );
17641764 const ASTContext &ASTCtx = S.getASTContext ();
17651765 APSInt Size = popToAPSInt (S, Call->getArg (2 ));
1766- const Pointer SrcPtr = S.Stk .pop <Pointer>();
1767- const Pointer DestPtr = S.Stk .pop <Pointer>();
1766+ Pointer SrcPtr = S.Stk .pop <Pointer>(). expand ();
1767+ Pointer DestPtr = S.Stk .pop <Pointer>(). expand ();
17681768
17691769 assert (!Size.isSigned () && " memcpy and friends take an unsigned size" );
17701770
@@ -1910,6 +1910,8 @@ static bool interp__builtin_memcpy(InterpState &S, CodePtr OpPC,
19101910 }
19111911 }
19121912
1913+ // SrcPtr = SrcPtr.expand();
1914+
19131915 assert (Size.getZExtValue () % DestElemSize == 0 );
19141916 if (!DoMemcpy (S, OpPC, SrcPtr, DestPtr, Bytes (Size.getZExtValue ()).toBits ()))
19151917 return false ;
0 commit comments