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

    <tr>
        <th>Summary</th>
        <td>
            clang miss-compiles openmp target update with stride. 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          fel-cab
      </td>
    </tr>
</table>

<pre>
    In the IRs, it can be seen that the `offload_maptypes` don't have the correct values

The following kernels were compiled with:
`clang -Iompvv/ -g -fopenmp --offload-arch=native -fopenmp-version=50 -emit-llvm -S `
`clang version 17.0.0 (https://github.com/llvm/llvm-project.git ca4c5331823755d5f7ae28a8bcaaa0fed21cf762)`

Three versions
1. `#pragma omp target update to(result[0:N:2])`
```
@.offload_maptypes.2 = private unnamed_addr constant [1 x i64] [i64 1]
@3 = private unnamed_addr constant [86 x i8] c";result[0:64:2];tests/5.0/target_update/test_target_update_to_discontiguous.c;22;11;;\00", align 1
```

2. `#pragma omp target update from(result[0:N:2])`
```
@.offload_maptypes.5 = private unnamed_addr constant [1 x i64] [i64 2]
@5 = private unnamed_addr constant [88 x i8] c";result[0:64:2];tests/5.0/target_update/test_target_update_from_discontiguous.c;22;11;;\00", align 1
```

3. `#pragma omp target update from(s.data[0:s.len:2])`
```
@.offload_maptypes.7 = private unnamed_addr constant [2 x i64] [i64 0, i64 281474976710674]
@10 = private unnamed_addr constant [97 x i8] c";s.data[0:s.len:2];tests/5.0/target_update/test_target_update_mapper_from_discontiguous.c;31;5;;\00", align 1
```

In this one, 
`281474976710674  = 0x1000000000012`
`And it Should be    0x100000000012`

The complete programs can be found in:

https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/target_update/test_target_update_from_discontiguous.c
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/target_update/test_target_update_mapper_from_discontiguous.c
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/target_update/test_target_update_to_discontiguous.c

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVtuO2zYQ_Rr6ZSCBF938oId1XAMLBC3QLfpq0OJIZkuRAkl5k78vqNVem6TuNkUMQQat4cyZc2SekSHowSK2pNyRcr-Rczw73_Zosk6eNienPre3FuIZ4fbXQPgH0BE6aeGEEBDTExmXx6Siru-Nk-o4yil-njCQioJylvA6wllecInrnPfYRbhIM2MgdE_ozcP9tzNC74xx99oO8Cd6iybAPfq0aZy0QQX3Op6JWDeQinZG2gGyWzdOlwvhB8gGyHo3oR0nyLIVUSZ9dyZib2XUF3wKyC7og3aWiH1JIcNRx8yYywjZXWrnTZE1GFid05wC4c05xikkNPxA-GHQ8Tyf8s6NhB9SmvUrm7z7A7uYDwt1RVcKwRou6rJUZV9L5I1sTp2UkvaoOOv6uuKEb58RrOx4xEcQK28sX3ByMXk5jBLcOEGUfsAI86RkRIiO8MZjmE0k5Y4ScfMzETeclPtXFSq6Xg_LguZvtcw5ELGHyetLyjtbK0dUR6mUh87ZEKWNQModg0-gq4KU-7TSVQEsFXvMK67L0lQpTZOydIRzInaveqiKxybELmKIgfBDmVPCDw_dHx-6T2sM8fjqx2N0R6VD52zUw-zmkHdE7JYajBGxS1f5gdJUln8AafRggX2Zp-XO_1GE3qd34vvIUL5XBv5ShiuzNM3_J0Mi5fsKIa4VIuRKRrk2EXKD9p1i1NfRyP8mBl1O0qRKw4q62NZVzWhVFy81YvS67Nv6rUhf7-8dOo1ymtB_TS6RlCrfo9biKjqAs5g2PEW-YQQWEugnRp8-jL8U6caq5El3ZzcblWwJ4FX4y-gnm0l-YjAiTN4NXo7h0dN6N6d89tljlvs3Tvq7Xz5-_P0nwg_BGXPB42JDJ-NOhB9GGSL6ldf__u_4MVC-9QL8GERfOMEXIBvVCrUVW7nBllV1s61LUTSbcytZQ0vVFFRR1tFTKXhVNaIvRMGVYttmo1tOuaCCVaygnDe5Eqg6WdKm4Io2NZKC4ii1yZOj584PGx3CjG3FipJvjDyhCY8zlG8X2z_NQyAFNTrE8Lwt6miwfZgoRh1Cto42Adah5fWJleYdCNFrhTlsZm_afzd0EH5YgCZ-F6x_BQAA__-TFg1d">