https://github.com/amitamd7 created https://github.com/llvm/llvm-project/pull/157443
This patch adds the check where pointer-based array sections are not considered while deducing `ElementType` of the array items. >From 57bd313653a208eefbd5d349704ea984f499d08a Mon Sep 17 00:00:00 2001 From: amtiwari <amtiw...@amd.com> Date: Mon, 8 Sep 2025 08:23:21 -0400 Subject: [PATCH] handle_array_pointer_var_check --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index b38eb54036e60..416a8c1ad4a03 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -7930,10 +7930,12 @@ class MappableExprsHandler { ElementType = CAT->getElementType().getTypePtr(); else if (VAT) ElementType = VAT->getElementType().getTypePtr(); - else - assert(&Component == &*Components.begin() && - "Only expect pointer (non CAT or VAT) when this is the " - "first Component"); + else if (&Component == &*Components.begin()) { + // Handle pointer-based array sections like data[a:b:c] + if (const auto *PtrType = Ty->getAs<PointerType>()) { + ElementType = PtrType->getPointeeType().getTypePtr(); + } + } // If ElementType is null, then it means the base is a pointer // (neither CAT nor VAT) and we'll attempt to get ElementType again // for next iteration. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits