@@ -32,6 +32,8 @@ using DataFunc =
3232 TYPE_SWITCH_CASE (PT_Uint32, B) \
3333 TYPE_SWITCH_CASE (PT_Sint64, B) \
3434 TYPE_SWITCH_CASE (PT_Uint64, B) \
35+ TYPE_SWITCH_CASE (PT_IntAP, B) \
36+ TYPE_SWITCH_CASE (PT_IntAPS, B) \
3537 TYPE_SWITCH_CASE (PT_Bool, B) \
3638 default : \
3739 llvm_unreachable (" Unhandled bitcast type" ); \
@@ -51,6 +53,8 @@ using DataFunc =
5153 TYPE_SWITCH_CASE (PT_Uint32, B) \
5254 TYPE_SWITCH_CASE (PT_Sint64, B) \
5355 TYPE_SWITCH_CASE (PT_Uint64, B) \
56+ TYPE_SWITCH_CASE (PT_IntAP, B) \
57+ TYPE_SWITCH_CASE (PT_IntAPS, B) \
5458 TYPE_SWITCH_CASE (PT_Bool, B) \
5559 TYPE_SWITCH_CASE (PT_Float, B) \
5660 default : \
@@ -384,10 +388,10 @@ bool DoBitCastToPtr(InterpState &S, const Pointer &P, Pointer &DestPtr,
384388
385389 CharUnits ObjectReprChars = ASTCtx.getTypeSizeInChars (P.getType ());
386390 const std::byte *M = Bytes.getBytes (BitOffset, 1234 );
387- std::byte *Buff = (std::byte *) std::malloc (
388- ObjectReprChars.getQuantity ()); // [sizeof(T)] ;
391+ std::byte *Buff =
392+ (std::byte *) std::malloc ( ObjectReprChars.getQuantity ());
389393 std::memcpy (Buff, M, ObjectReprChars.getQuantity ());
390- // Val.bitcastToMemory(Buff);
394+
391395 if (BigEndian)
392396 swapBytes (Buff, ObjectReprChars.getQuantity ());
393397
@@ -407,7 +411,7 @@ bool DoBitCastToPtr(InterpState &S, const Pointer &P, Pointer &DestPtr,
407411 BITCAST_TYPE_SWITCH (T, {
408412 T &Val = P.deref <T>();
409413
410- size_t ValueReprBits = T:: valueReprBits (ASTCtx);
414+ size_t ValueReprBits = Val. valueReprBits (ASTCtx);
411415 // Check if any of the bits we're about to read are uninitialized.
412416 bool HasIndeterminateBits =
413417 !Bytes.allInitialized (BitOffset, ValueReprBits);
@@ -440,7 +444,7 @@ bool DoBitCastToPtr(InterpState &S, const Pointer &P, Pointer &DestPtr,
440444 if (BigEndian) {
441445 swapBytes (Copy, ValueReprBits / 8 );
442446 }
443- Val = T::bitcastFromMemory (Copy);
447+ Val = T::bitcastFromMemory (Copy, Val. bitWidth () );
444448 std::free (Copy);
445449
446450 if (!HasIndeterminateBits)
0 commit comments