hliao added a comment. In D76365#1947462 <https://reviews.llvm.org/D76365#1947462>, @hliao wrote:
> In D76365#1947103 <https://reviews.llvm.org/D76365#1947103>, @tra wrote: > > > In D76365#1946938 <https://reviews.llvm.org/D76365#1946938>, @hliao wrote: > > > > > The new revision is accepted, right? Just want to confirm as it seems you > > > accept it before I posted the new change. > > > > > > The approval was for the old version. I didn't undo it when I reopened the > > review. The diff looks OK, though the last variant still leaves open the > > question of what's the meaning of these attributes and what are the > > restrictions on their use. > > > > So what's the reasonable thing to do if I write something like this: > > > > __attribute__((device_builtin_surface_type)) int foo; // Ignore? Warn? > > Error? Do something sensible? > > > > > For such case, NVCC reports the following error: > > kernel.cu(3): error: attribute "device_builtin_surface_type" does not apply > here > > 1 error detected in the compilation of "kernel.cpp1.ii" > > > That error is generated after `nvcc --keep -g -c kernel.cu` from this sample > code (`kernel.cu`) > > #include <cuda.h> > > __attribute__((device_builtin_surface_type)) int foo; > > int f() { > return foo; > } > > > I changed that sample code a little bit to this one > > #include <cuda.h> > > #if 1 > typedef __attribute__((device_builtin_surface_type)) int dev_texsurf_int_t; > dev_texsurf_int_t foo; > #else > __attribute__((device_builtin_surface_type)) int foo; > #endif > > int f() { > return foo; > } > > > It triggers a crash in NVCC with the same compilation command line. > > We may enhance clang to report an error instead of a warning only so far. I tried one more sample, it triggers NVCC crash as well. struct __attribute__((device_builtin_surface_type)) ref { int x; } R; int f() { return R.x; } For this case, clang reports error due to the same checks added in this patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76365/new/ https://reviews.llvm.org/D76365 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits