This patch fixes an issue with the use of ___kmpc_alloc_shared to allocate dynamically sized VLAs on GPUs when the declaration escapes the context. For example:
#pragma omp target teams distribute
for (int i=0; i<M; i++) {
int N = 10;
double A[N];
#pragma omp parallel for
for(int j=0; j<N; j++) {
A[j] = j;
}
}This will generate a pair of __kmpc_alloc_shared / __kmpc_free_shared to handle the allocation and deallocation of A inside the target region but this emission will be delayed until the VLA size is availble in user code.
You can remove this include