This patch aims to resolve issue: https://github.com/llvm/llvm-project/issues/60345
The following code:
#include <iostream> #include <omp.h> #include <stdlib.h> int main() { int N =1<<30; int *a = new int[N]; #pragma omp target data map(tofrom:a[:N]) { #pragma omp target teams distribute parallel for for(int i = 0; i < N; i++) { int local_a[10]; #pragma omp allocate(local_a) allocator(omp_pteam_mem_alloc) for(int j = 0; j < 10; j++) local_a[j] = a[(i+j)%N]; a[i] = local_a[0]; } } std::cout << a[0] << "\n"; }
Fails with the following linker errors:
clang-linker-wrapper: error: <unknown>:0: local_a: unsupported initializer for address space clang-linker-wrapper: error: Errors encountered inside the LTO pipeline.
Please use poison instead of undef wherever possible as we are tying to remove undef. The replacement is usually safe when you just need a placeholder.
Thank you!