brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 8b25ec3 Raw
39 lines · plain
1// REQUIRES: amdgpu-registered-target2// RUN:  %clang_cc1 -fsyntax-only -x hip -fcuda-is-device -verify -triple amdgcn %s3#define __device__ __attribute__((device))4#define __host__ __attribute__((host))5#define __global__ __attribute__((global))6#define __shared__ __attribute__((shared))7 8typedef float ZEROARR[0];9 10float global_array[0];11 12__global__ void global_fun() {13    extern __shared__ float externArray[];14    ZEROARR TypeDef; // expected-error {{zero-length arrays are not permitted in HIP device code}}15    float array[0];  // expected-error {{zero-length arrays are not permitted in HIP device code}}16}17 18// should not throw error for host side code.19__host__ void host_fun() {20    float array[0];21}22 23template <typename Ty, unsigned Size>24__device__ void templated()25{26   Ty arr[Size];  // expected-error {{zero-length arrays are not permitted in HIP device code}}27}28 29__host__ __device__ void host_dev_fun()30{31    float array[0]; // expected-error {{zero-length arrays are not permitted in HIP device code}}32}33 34__device__ void device_fun()35{36    __shared__ float array[0]; // expected-error {{zero-length arrays are not permitted in HIP device code}}37    templated<int,0>(); // expected-note {{in instantiation of function template specialization 'templated<int, 0U>' requested here}} 38}39