https://bugs.llvm.org/show_bug.cgi?id=44803

            Bug ID: 44803
           Summary: "dynamic initialization is not supported" when
                    compiling CUDA + Thrust code
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: CUDA
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

When compiling the following piece of code with on Windows:

```

#include <thrust/device_vector.h>
#include <thrust/transform.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/copy.h>

using namespace thrust;

int main()
{
    int size = 100;
    device_vector<int> v(100);

    auto counter = make_counting_iterator(0);
    copy(counter, counter + size, v.begin());

    auto multiply = [] __host__ __device__ (const int&x){ return x * x;};
    transform(v.begin(), v.end(), v.begin(), multiply);
}

```

I get the following series of errors:

```

thrust/functional.h:1452:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<0>::type _1;
thrust/functional.h:1461:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<1>::type _2;

...

thrust/functional.h:1533:74: error: dynamic initialization is not supported for
__device__, __constant__, and __shared__ variables.
static const __device__ thrust::detail::functional::placeholder<9>::type _10;

```


I used the latest release of Thrust.
I checked the type being initialized and it looks like it has no data and an
empty constructor.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to