[clang] [OpenCL] Fix an infinite loop in builidng AddrSpaceQualType (PR #92612)

Changpeng Fang via cfe-commits cfe-commits at lists.llvm.org
Fri May 17 16:29:15 PDT 2024


================
@@ -537,8 +537,9 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType,
       elementType.isTriviallyCopyableType(CGF.getContext())) {
     CodeGen::CodeGenModule &CGM = CGF.CGM;
     ConstantEmitter Emitter(CGF);
+    Qualifiers Quals;
     QualType GVArrayQTy = CGM.getContext().getAddrSpaceQualType(
-        CGM.getContext().removeAddrSpaceQualType(ArrayQTy),
+        CGM.getContext().getUnqualifiedArrayType(ArrayQTy, Quals),
----------------
changpeng wrote:

Do you mean we should actually fix removeAddrSpaceQualType? Somewhere inside removeAddrSpaceQualType, we
should use getUnqualifiedArrayType if it is an arrayType, and getSingleStepDesugaredType othereise?
I have to admit that I have no experience in this field, so I am relying on you and @svenvh to move on for a reasonable fix. Thanks.

https://github.com/llvm/llvm-project/pull/92612


More information about the cfe-commits mailing list