diff --git a/src/mapleall/maple_be/src/be/lower.cpp b/src/mapleall/maple_be/src/be/lower.cpp index db9ef265a9002138d1914ba4479dfb64258bdbb3..340f1522188e18b29d3a5b79ed0b16027c879db4 100644 --- a/src/mapleall/maple_be/src/be/lower.cpp +++ b/src/mapleall/maple_be/src/be/lower.cpp @@ -1186,11 +1186,11 @@ StmtNode *CGLowerer::LowerCall(CallNode &callNode, StmtNode *&nextStmt, BlockNod MIRPtrType *pretType = static_cast((calleeFunc->GetNthParamType(0))); CHECK_FATAL(pretType != nullptr, "nullptr is not expected"); retType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(pretType->GetPointedTyIdx()); - CHECK_FATAL(retType->GetKind() == kTypeStruct, "make sure retType is a struct type"); + CHECK_FATAL((retType->GetKind() == kTypeStruct) || (retType->GetKind() == kTypeUnion), "make sure retType is a struct type"); } /* if return type is not of a struct, return */ - if (retType->GetKind() != kTypeStruct) { + if ((retType->GetKind() != kTypeStruct) && (retType->GetKind() != kTypeUnion)) { return &callNode; } diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp index 15a272e27ddcb87e0a2fb11288b701f912cce5e7..20b3fc97092dd1262f06fa59b4835e66b1c798ea 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_abi.cpp @@ -211,7 +211,7 @@ int32 ClassifyAggregate(BECommon &be, MIRType &mirType, AArch64ArgumentClass cla for (i = 0; i < sizeOfTyInDwords; ++i) { classes[i] = kAArch64NoClass; } - if ((mirType.GetKind() != kTypeStruct) && (mirType.GetKind() != kTypeArray)) { + if ((mirType.GetKind() != kTypeStruct) && (mirType.GetKind() != kTypeArray) && (mirType.GetKind() != kTypeUnion)) { return ProcessNonStructAndNonArrayWhenClassifyAggregate(mirType, classes, classesLength); } int32 subNumRegs;