Issue 136294
Summary OpenMP array shaping failing test case
Labels new issue
Assignees
Reporter ravurvi20
    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)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to