<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/136294>136294</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
OpenMP array shaping failing test case
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ravurvi20
</td>
</tr>
</table>
<pre>
The test case fails to compile due to unsupported array shaping operations in #pragma omp target update.
Testcase:
```
#pragma omp begin declare target
int do_work(double *a, int nx, int ny);
int other_work(double *a, int nx, int ny);
#pragma omp end declare target
void exch_data(double *a, int nx, int ny);
void array_ing(double *a, int nx, int ny)
{
// map data to device and do work
#pragma omp target data map(a[0:nx*(ny+2)])
{
// do work on the device
#pragma omp target // map(a[0:nx*(ny+2)]) itional here
do_work(a, nx, ny);
// update boundary poins (two column 2D array) on the host
// pointer is shaped to 2D array using the shape-operator
#pragma omp target update from( (([nx][ny+2])a)[0:nx][1], \
(([nx][ny+2])a)[0:nx][ny] )
// exchange ghost points with neighbors
exch_data(a, nx, ny);
// update ghost points (two column 2D array) on the device
// pointer is shaped to 2D array using the shape-operator
#pragma omp target update to( (([nx][ny+2])a)[0:nx][0], \
(([nx][ny+2])a)[0:nx][ny+1] )
// perform other work on the device
#pragma omp target // map(a[0:nx*(ny+2)]) is optional here
other_work(a, nx, ny);
}
}
```
```
array.c:18:34: error: OpenMP array shaping operation is not allowed here
18 | #pragma omp target update from( (([nx][ny+2])a)[0:nx][1], \
| ^
array.c:19:34: error: OpenMP array shaping operation is not allowed here
19 | (([nx][ny+2])a)[0:nx][ny] )
| ^
array.c:18:2: error: expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'
18 | #pragma omp target update from( (([nx][ny+2])a)[0:nx][1], \
| ^
array.c:26:32: error: OpenMP array shaping operation is not allowed here
26 | #pragma omp target update to( (([nx][ny+2])a)[0:nx][0], \
| ^
array.c:27:32: error: OpenMP array shaping operation is not allowed here
27 | (([nx][ny+2])a)[0:nx][ny+1] )
| ^
array.c:26:2: error: expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'
26 | #pragma omp target update to( (([nx][ny+2])a)[0:nx][0], \
| ^
6 errors generated.
```
Environment Info:
OpenMP version - 5.0/5.1/5.2
Compiler - clang version 21.0.0
[Godbolt](https://godbolt.org/z/5MKcKMePb)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEV99vozgQ_mucl1GRMSEkDzyQdnM6rarbh32vDEzAd2Aj26Tt_fWnMbRNrr-33d0oSoBh5pv5vhkbpHOq0Yg5S7csvVjI0bfG5lYeRntQgi9KU9_m31sEj85DJR3CXqrOgTdQmX5QHUI9Ip2O2o3DYKzHGqS18hZcKwelGzADWumV0Q6UBiaSwcqml2D6Aby0DXoYh1p6jBgvGC--o_MExZJiusBWfP7y4tS9xEZpqLHqpMU5GOOF0h5qc3Vt7D9MrGszlh0CE4Vk4hzIqG_uj26Z2LBkO3sZ36J9r-NpTqjrxxkdjKoBb6r2qpZeviN2cAx8XindvM2RFywjX2Bix8QOejkAwZJMNR5UhSApSQOh0HDjE6IEl14OTKwlS7ecJQUhFUysCWcrCCu9mBDhFHKODUaDb3FGfRbpIc_XsUBRK8kOWrQ49ceR1oGTiY9jgR4SmzoNSjPqWtpbGIzSDphY-2tq6W7sNYiLiXFCmwtojfNwFIbcPFpQLrQ51sTtnR-Mjvqe_ILxbJoAY58lYM5qb03PxJrSoW-61TdUdLqdOQgEyEDFHUXBHAfLObD0fIJ4n7u-ZekFzJ3zUCO1q9QNQhOqDyU7uFa-BY2qaUtjXeDkuK_fKsBJzFfpP-6fn8i_Nz_CPv8w-yIo-FiBAe3e2H5alX7eQDkww-lQna6DT2sKLLt4-DtZo09PgyZRxZIiXrOkSJYsKQCtNZYO_hpQX357bsug5LTxILvOXGN9nx9AvAaWncOvmKfwITCWfjmtZ_OJ9WwmiA_M7guJEvHiJE-8GbAKm7WHDqXzYDRtKx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