https://github.com/knightXun updated https://github.com/llvm/llvm-project/pull/70496
>From d51afcd3e8f41bcf94259561e71fd10628fc78c3 Mon Sep 17 00:00:00 2001 From: xuknight <badgangkil...@gmail.com> Date: Sat, 28 Oct 2023 02:52:43 +0800 Subject: [PATCH] [clang][wasm] Resolve assertion errors caused by converting ComplexType to RecordType When a function parameter is of the built-in Complex type in Clang, the conversion from ComplexType to RecordType is not possible, resulting in a crash in Clang. RecordType is a helper class for structs, unions, and classes. --- clang/lib/CodeGen/Targets/WebAssembly.cpp | 3 +++ clang/test/CodeGen/pr70496.c | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 clang/test/CodeGen/pr70496.c diff --git a/clang/lib/CodeGen/Targets/WebAssembly.cpp b/clang/lib/CodeGen/Targets/WebAssembly.cpp index bd332228ce5bbe..b3f6473eb9bc74 100644 --- a/clang/lib/CodeGen/Targets/WebAssembly.cpp +++ b/clang/lib/CodeGen/Targets/WebAssembly.cpp @@ -114,6 +114,9 @@ ABIArgInfo WebAssemblyABIInfo::classifyArgumentType(QualType Ty) const { return ABIArgInfo::getDirect(CGT.ConvertType(QualType(SeltTy, 0))); // For the experimental multivalue ABI, fully expand all other aggregates if (Kind == WebAssemblyABIKind::ExperimentalMV) { + if (Ty->getAs<ComplexType>()) { + return ABIArgInfo::getDirect(); + } const RecordType *RT = Ty->getAs<RecordType>(); assert(RT); bool HasBitField = false; diff --git a/clang/test/CodeGen/pr70496.c b/clang/test/CodeGen/pr70496.c new file mode 100644 index 00000000000000..e5abf3e547ac27 --- /dev/null +++ b/clang/test/CodeGen/pr70496.c @@ -0,0 +1,3 @@ +// RUN: %clang --target=wasm32 -mmultivalue -Xclang -target-abi -Xclang experimental-mv %s -S -Xclang -verify + +float crealf() { return 0;} // expected-no-diagnostics \ No newline at end of file _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits