Skip to content

Conversation

hnrklssn
Copy link
Member

This test was broken by #162714. Previously the [[clang::opencl_private]] attribute was applied first, resulting in the clashing __global attribute being ignored. Now that __global is applied first, it results in an error, and then [[clang::opencl_private]] is applied, resulting in another error.

@hnrklssn hnrklssn requested review from compnerd and svenvh October 10, 2025 05:35
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Oct 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2025

@llvm/pr-subscribers-clang

Author: Henrik G. Olsson (hnrklssn)

Changes

This test was broken by #162714. Previously the [[clang::opencl_private]] attribute was applied first, resulting in the clashing __global attribute being ignored. Now that __global is applied first, it results in an error, and then [[clang::opencl_private]] is applied, resulting in another error.


Full diff: https://github.com/llvm/llvm-project/pull/162785.diff

1 Files Affected:

  • (modified) clang/test/SemaOpenCL/address-spaces.cl (+2-1)
diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
index 86435b7b15b34..6c3ee899be617 100644
--- a/clang/test/SemaOpenCL/address-spaces.cl
+++ b/clang/test/SemaOpenCL/address-spaces.cl
@@ -265,7 +265,8 @@ void func_multiple_addr2(void) {
   __attribute__((opencl_private)) private_int_t var5;  // expected-warning {{multiple identical address spaces specified for type}}
   __attribute__((opencl_private)) private_int_t *var6; // expected-warning {{multiple identical address spaces specified for type}}
 #if __OPENCL_CPP_VERSION__
-  __global int [[clang::opencl_private]] var7;         // expected-error {{multiple address spaces specified for type}}
+  __global int [[clang::opencl_private]] var7;         // expected-error {{multiple address spaces specified for type}} \
+                                                       // expected-error {{function scope variable cannot be declared in global address space}}
   __global int [[clang::opencl_private]] *var8;        // expected-error {{multiple address spaces specified for type}}
   private_int_t [[clang::opencl_private]] var9;        // expected-warning {{multiple identical address spaces specified for type}}
   private_int_t [[clang::opencl_private]] *var10;      // expected-warning {{multiple identical address spaces specified for type}}

@hnrklssn
Copy link
Member Author

Enabling auto-merge to unblock, feel free to post-review

@hnrklssn hnrklssn enabled auto-merge (squash) October 10, 2025 05:36
@hnrklssn hnrklssn merged commit 0df4e63 into llvm:main Oct 10, 2025
11 of 12 checks passed
Copy link
Member

@svenvh svenvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants