Having the following code pattern will result in incorrect diagnostic
int main() {
int arr[10];
#pragma omp target data map(arr[:])
#pragma omp target map(arr)
{}
}
t.cpp:4:24: error: original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage
#pragma omp target map(arr)
^~~
t.cpp:3:29: note: used here
#pragma omp target data map(arr[:])
^~~~~~
1 error generated.
You have to document what you are trying to accomplish here, something like "Check if the extra components of the expressions in the enclosing data environment are redundant for the current base declaration. If they are, the maps completely overlap, which is legal."
You may add the snippet in that comment so that we can refer to that when trying to understand this code.