https://bugs.llvm.org/show_bug.cgi?id=50508
Bug ID: 50508
Summary: 'Incomplete type' error when mapping a global extern
std::array
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Runtime Library
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
An error occurs when compiling the following file (transfer.cpp) that attempts
to map a global scope std::array object declared as extern:
#include<array>
#pragma omp declare target
extern std::array<double, 4> arr;
#pragma omp end declare target
void copy_host_to_device()
{
#pragma omp target update to(arr)
}
void copy_device_to_host()
{
#pragma omp target update from(arr)
}
Compiled with clang++ (version 13.0.0 (https://github.com/llvm/llvm-project.git
59d938e649e62db0cef4903d495e838fbc6a6eb8) for a V100 target as:
clang++ -Wall -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target
-march=sm_70 -c transfer.cpp -o transfer.o
The error given is:
transfer.cpp:9:32: error: incomplete type 'std::array<double, 4>' where a
complete type is required
#pragma omp target update to(arr)
^~~
transfer.cpp:9:3: error: expected at least one 'to' clause or 'from' clause
specified to '#pragma omp target update'
#pragma omp target update to(arr)
^
transfer.cpp:14:34: error: incomplete type 'std::array<double, 4>' where a
complete type is required
#pragma omp target update from(arr)
^~~
transfer.cpp:14:3: error: expected at least one 'to' clause or 'from' clause
specified to '#pragma omp target update'
#pragma omp target update from(arr)
^
4 errors generated.
As a workaround (found by Johannes Doerfert), it works if the array is
instantiated in the first function as:
void copy_host_to_device()
{
arr[0];
#pragma omp target update to(arr)
}
The code for this reproducer is available at:
https://github.com/jtramm/omp_target_issues/blob/master/array_simple/transfer.cpp
and a larger version with a main can be found at:
https://github.com/jtramm/omp_target_issues/tree/master/array
--
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