<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/69606>69606</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP][AArch64] mapping/target_derefence_array_pointrs.cpp failing
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ceseo
      </td>
    </tr>
</table>

<pre>
    This test fails with/without LTO on the current `main`:

```
# | /home/GitHub/llvm/llvm-project/openmp/libomptarget/test/mapping/target_derefence_array_pointrs.cpp:28:12: error: CHECK: expected string not found in input
# |  // CHECK: 3
# | ^
# | <stdin>:1:103: note: scanning from here
# | Libomptarget message: explicit extension not allowed: host address specified is 0x0000ffffd8efdd80 (12 bytes), but device allocation maps to host at 0x0000ffffd8efdd80 (8 bytes)
# | ^
# | <stdin>:1:104: note: possible intended match here
# | Libomptarget message: explicit extension not allowed: host address specified is 0x0000ffffd8efdd80 (12 bytes), but device allocation maps to host at 0x0000ffffd8efdd80 (8 bytes)
```

Looking at the code:

```
void foo(int **t1d) {
  int ***t2d = &t1d;
  int ****t3d = &t2d;
  *t1d = (int *)malloc(3 * sizeof(int));
  int j, a = 0, b = 0;

  for (j = 0; j < 3; j++)
    (*t1d)[j] = 0;
#pragma omp target map(tofrom : (*t1d)[0 : 3])
  { (*t1d)[1] = 1; }
  // CHECK: 1
  printf("%d\n", (*t1d)[1]);
#pragma omp target map(tofrom : (**t2d)[0 : 3])
  { (**t2d)[1] = 2; }
  // CHECK: 2
 printf("%d\n", (**t2d)[1]);
#pragma omp target map(tofrom : (***t3d)[0 : 3])
  { (***t3d)[1] = 3; }
  // CHECK: 3
  printf("%d\n", (***t3d)[1]);
#pragma omp target map(tofrom : (**t1d))
  { (*t1d)[0] = 4; }
  // CHECK: 4
  printf("%d\n", (*t1d)[0]);
#pragma omp target map(tofrom : (*(*(t1d + a) + b)))
  { *(*(t1d + a) + b) = 5; }
 // CHECK: 5
  printf("%d\n", *(*(t1d + a) + b));
}
```

Looks like `****t3d` is clashing with `***t2d`.

Is this testcase correct?

*Note: I cannot reproduce this on x86.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVk1z4ygT_jX40vW6EFhfBx_8Eb8ztdmdPcw9hUTLIiOBClA-9tdvge3YViWTpHLbKkci9KOn-2kaaOGc2mvEJUnXJN3OxOhbY5c1OjSzysjn5c9WOfDoPDRCdQ4elW8J24WXGT3c_vwBRoNvEerRWtQeSEZ7oTTJKOErQreEnp4ZPf4O_zIOJN8AYbvW9EjY7v_KfxsrwnZd99AfX_8brLnH2hO2MwPqfgjzqjL94IXdY5gP0RG268UwKL0PE9FyJ9Fig7rGO2GteL4bjNLeunk9DISvWEH4KmGErwCtNTYMNt9uNn_EmacBa48SnLdK70EbD40ZtQSlQelh9NcaggjCdmcCPtGY3kwm-MZ5qTThNyGM8Ed5-FAbj-HtaqF1cN1Y00OLFq8Jbi9yAD06J_Z4jLxTtfKATx61U0bH4EXXmUeUAdEa50FIadE5cAPWqlEoQTmgT5RS2jRNIwtspCwoEFYkDKpnj46wkrANVKMHiQ-qxkhaCx989GJw4M2R3L9BVZyZPp-exWV6BuOcqjoEpT1qiRJ64ev2P5uoydaJz1tjfoUKEf6w_4zE3--4B6MkNMYQVqiwUdmKsJVPJGElkHx9AAGcbcHMJBC-BcKygOSvowKQn4HsEnjwcbSdHZd9zAphBQ8T4NQ_aJoDImawnDi7D0kVkYfG_B6HJ9QJ2xgbHN2_mCEMN8DjkLB1_JUneAiweMkDSdf3JN1OqRkfrNj3Akw_wKmWxEBY4U3coKFeJjwUDgdBur3wRvL1FJec_CUhQJJvz4m7PlOSk2GwSvsm0jDCUknSjY7DzWvcl5n8jJDD4n9IyyX0RQ57Rw47Gt5VM2X_gqBDnX5U0yX6RRZ_Rxb_8Cq94uEra3VY89-WGj2JWLwjYvH5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