[PATCH] D79344: [cuda] Start diagnosing variables with bad target.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 13:26:52 PDT 2020


hliao marked an inline comment as done.
hliao added inline comments.


================
Comment at: clang/test/SemaCUDA/variable-target.cu:6
+
+static int gvar;
+// expected-note at -1{{'gvar' declared here}}
----------------
tra wrote:
> The current set of tests only verifies access of host variable from device side. We need to check that things work in other direction (i.e. device veriable is not accessible from host). A bit of it is covered in function-overload.cu, but it would make sense to deal with all variable-related things here.
> 
> It would be great to add more test cases:
> * access of device variable from various host functions.
> * test cases to verify that &var and sizeof(var) works for device vars in host functions.
> 
> 
yeah, as noted in both the message and some sources, that direction diagnosing is more complicated because the host code still be able to access shadow variables. We need to issue warnings on improper usage, such as variable direct read/write. I want to address that in another patch as more change is required to check how a variable is being used.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79344





More information about the cfe-commits mailing list