<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144827>144827</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[openmp][clang] Compilation error for omp update directive when multi dimension array is allocated on heap
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aywala
</td>
</tr>
</table>
<pre>
```cpp
#include <stdio.h>
#include <stdlib.h>
int main() {
int **a = (int**)malloc(100*sizeof(int*));
for(int i=0;i<100;i++) {
a[i] = (int*)malloc(100*sizeof(int));
}
for(int i=0;i<100;i++) {
for(int j=0;j<100;j++) {
a[i][j]=0;
}
}
#pragma omp target data map(tofrom: a[0:1][0:100])
{
#pragma omp target teams
#pragma omp distribute
for (int j = 0; j < 100; j++) {
a[0][j] += j;
}
#pragma omp target update from(a[0:1][0:100])
}
printf("a[0][10]: %d\n", a[0][10]);
}
```
```
<source>:22:44: error: section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound
22 | #pragma omp target update from(a[0:1][0:100])
| ^
1 error generated.
```
https://godbolt.org/z/h5vha6E5v
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVN2S4ioQfprOTdda2CQaL3IRdX0PEojBQyAFxKnZpz9Foqvj2ZmzNSlKWrq__vm6QYSgz1apCoo9FMdMTLF3vhLvb8KIrHHyvYINW1Y7jsBqIK5tayapEPghRKndqgf-808qo5u7DhFYrW3EQWgLVALtELb7WYOYFEA1UC0Q-BGBSm3jcgK0G4QxrgUq14wB1UH_Uq57stmlxe_OOucXHWrgRwZ8r4EfEjRJtJ_Xc_T0CSj2Gorja_ivY38MDNvjt1J4WF9u1pff1pfPEn5OGor9JW0L-MnokdFdSj9AfPTiPAh0w4hR-LOKKEUUOIgRqIyu824AXs8BGPB6vQSZRcbSH9p9CLP_1G9UYggvec-YD8ZSh-h1M0V1IwTvjMwNSWXN4gEXWvBLXl45Yg-OMIH4MTH9GepB2p9zvRU2jVJEhTNVVP41U7Pv28notY3dfBvoKc_1vPNEaCGhOFggAjrgf0zuw7d4_X1RX2V-CG7yrUo3kddEwOs8T_6V984nIag2amfRKHuOPeqAkw2janWnlURhJbbCWhexUahtp7xXEhvViikoDFMTWq_HqCRehZlUwguLwnvxjq7Dyf5j3ZvFxk1WLqUTIWwPXwzEt0h-dfk_HxTpZVovNOBZWeVFVHL1wl8f4xiA10AnoNPZycaZuHL-DHT6BXTqi2svNj-LayYrLnd8JzJVrbcF44zttpusr0pqc77N-YZxYpt12eWd6KikTrRl2RUy0xUxKthmvWOUU7FZqQ0xtl0XRcdoo7occqYGoc3KmOuQYmc6hElV6zwvaZsZ0SgT5kecqDXCntPIFMfMVwnwo5nOAXJmdIjh4SLqaOaX343KDuNC6oIujogHN4zaiHkwForSvUzNuXVFap_m5qrwrVcWh8lEjVIPyoaEWfqfZiG9oIlZdBZ7JcZs8qZ6oVXHfmpWberzKWV4236M3l1UG4FOc8UB6HQr-lrRvwEAAP__c4bT8A">