[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 13:08:01 PDT 2018


tra added a comment.

In https://reviews.llvm.org/D47757#1204621, @ahatanak wrote:

> In https://reviews.llvm.org/D47757#1204561, @tra wrote:
>
> > It's a regression. There's a decent chance it breaks someone and this patch, if committed by itself, will end up being rolled back.
>
>
> Is the regression you are referring to about the static function case? I don't see a difference between ToT clang and my patch in the diagnostics they produce when I compile the following code:
>
>   __host__ void f();
>   static __host__ __device__ void g() { f(); }
>   __host__ __device__ void g2() { g(); } 
>
>
> Both error out when `-fcuda-is-device` is provided. If I comment out the definition of g2, it compiles fine.


The example above *is* expected to produce the error on device side, bacause g2() is externally visible, uses g(), which in turn uses host-only f().

I'm talking about a case where g() {f()} is present in the source code, but will not be codegen'ed on device side.

The code below is expected to compile. Note that g2() is host-only.

  __host__ void f(); 
  static __host__ __device__ void g() { f(); }
  __host__ void g2() { g(); } 


Repository:
  rC Clang

https://reviews.llvm.org/D47757





More information about the cfe-commits mailing list