mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Dont' trivial bitcast between differently sized structs.
Really we want to only cast between equally sized types. SIL does not really have a concept of types of the same size so this solution is a workaround (temporary) for acutal code in the standard library which casts a pointer of an UTF16 type to a pointer of an UTF8 type. rdar://18118602 Swift SVN r21470
This commit is contained in:
@@ -409,6 +409,15 @@ forwardAddressValueToUncheckedAddrToLoad(SILValue Address,
|
||||
|
||||
// If the output is trivial, we have a trivial bit cast.
|
||||
if (OutputIsTrivial) {
|
||||
|
||||
// The structs could have different size. We have code in the stdlib that
|
||||
// casts pointers to differently sized integer types. This code prevents
|
||||
// that we bitcast the values.
|
||||
SILType InputTy = UADCI->getOperand().getType();
|
||||
if (OutputTy.getStructOrBoundGenericStruct() &&
|
||||
InputTy.getStructOrBoundGenericStruct())
|
||||
return SILValue();
|
||||
|
||||
CastValue = B.createUncheckedTrivialBitCast(UADCI->getLoc(), StoredValue,
|
||||
OutputTy.getObjectType());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user