[PATCH] D91281: [CUDA][HIP] Diagnose reference of host variable

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 8 09:37:57 PST 2021


yaxunl added a comment.

In D91281#2609766 <https://reviews.llvm.org/D91281#2609766>, @yaxunl wrote:

> In D91281#2607082 <https://reviews.llvm.org/D91281#2607082>, @yaxunl wrote:
>
>> @tra I got some issue with this patch. There are cases that an expression using a host variable is compile-time constant, e.g.
>>
>>   int x;
>>   __device__ void fun() {
>>     sizeof(x);
>>   }
>>
>> Do we want to allow that? Thanks.
>
> It seems we should only diagnose ODR-use (https://en.cppreference.com/w/cpp/language/definition) of host variable in device functions.

Fix in https://reviews.llvm.org/D98193


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91281/new/

https://reviews.llvm.org/D91281



More information about the cfe-commits mailing list