================ @@ -0,0 +1,23 @@ +// expected-no-diagnostics + +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -aux-triple amdgcn-amd-amdhsa -fsyntax-only -verify -xhip %s +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fsyntax-only -fcuda-is-device -verify -xhip %s + +#include "Inputs/cuda.h" + +__global__ void kernel() { + __attribute__((address_space(0))) void *mem_ptr; + (void)__builtin_amdgcn_is_shared(mem_ptr); ---------------- yxsamliu wrote:
You are right. Clang actually adds implicit host or device attribute to builtin functions in `Sema::AddKnownFunctionAttributes`. Calling a device builtin in host function will cause a bad target error. I will add implicit device or host attribute to the overloaded builtin function. https://github.com/llvm/llvm-project/pull/138162 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits