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

    <tr>
        <th>Summary</th>
        <td>
            [clang] 32bit pointer (-fms-extensions __ptr32 __uptr) has no effect in ARM64
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          d-mozulyov
      </td>
    </tr>
</table>

<pre>
    ### Problem
The 32-bit pointer does not work on platforms other than x64, such as ARM64. See the [Godbolt listing](https://godbolt.org/z/55h65crqj).

### Sample
```cpp
#include <cstdint>

int param_std(int* foo) {
 int temp = *foo;
    *foo = 1;
    return temp + sizeof(foo);
}

int param_ptr32(int* __ptr32 __uptr bar) {
 int temp = *bar;
    *bar = 2;
    return temp + sizeof(bar);
}

int emulate_ptr32(uint32_t baz) {
    uint64_t baz64 = baz;
    int* bazptr = (int*)baz64;
    int temp = *bazptr;
 *bazptr = 3;
    return temp + sizeof(baz);
}
```

### Conclusions
The `param_ptr32` disassembler must be equal to `emulate_ptr32`, and different from `param_std`. Based on the [Godbolt listing](https://godbolt.org/z/55h65crqj), the MSVC compiler does just that. But clang does not take into account the 32bit pointer under ARM64 (and most likely under other than x64). Its size is 8 bytes, disassembler `param_std` and `param_ptr32` are the same.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMFu4zYQ_Rr6MrAgkZJsHXSI47roYYGiKXo1SGlkMaFILTnabvz1BSXHTtxgsYcFBBvgPJLvzRs-GYI-WcSaFTtW7Fdyot75ul0P7jyZV_dtpVz7WjMulg_-9E4ZHFi6Z-nD3z2C4GulCUanLaGH1mEA6wj-df4FnIXRSOqcHwI46tED9dLC9zJn_BHC1PQgAzz89aXME3hCBOoRWLH73bXKGQKjA2l7YsWe8W1PNAYmHhg_MH44LZDE-RPjhzPjh6Loy6LxX58Zr5KF4eX3Sv9JDqPBy2qZLl8zjlecto2ZWgQmHptArbbExG_vz9KWYJReDsdALePbiOAP0DnHeAVss1tgEHGEwwhM7IHxhwgQb0WAy9JczT4UPNLk7WUv30HQZ3Qd49vliiuWbfaf8xrJC35jdlwW4HicRvKgpP8x0Qi4I6qkn6v854guV_yIKA6TkYRXqpO2JPiRQMnzR3YAEItlvhTLfCYSYe-pXKQqeY4SFyEX_YxX8757_J3muPEGuS7NAPGzss-fy36bs89H8tHFkQva2XB7VaxM35tZptDqIEPAQRn0MEyBQCHg10kaIBfxH3tapvGBSdtCq7sOPVqCzrvhdnIc3zJNYCcDtvGl_qqnFy-OZ315-ucRGjeM2rwFw3PkTb2kBHYTQWOkPd0ig-QLRmscyKZxU_RoDpj3-TLZFv0SGNHjKHBwIbJ9QfN6Kd8nTZXAHxRmp0AH2IJ6JQyR54eu3rVm7t7_jZB-SakgB0xWbS3aSlRyhXVWbkVW5NlGrPpadYXMsybjMstloyS2zabNqjLjZc4Vtitd85SLtEgF53klRCLKjRJZtd3ypir5pmB5ioPUJjHm2xBbvdIhTFiXvBDlykiFJrzFtq8jaK2mU2B5Gp0Lt22kycwBP7ebFfu7ljK-XXdDWON3QjvP4V1mxBfZy-gRYNdhQ6DtYsFq8qa-mw1N_aSSxg2MHyKHy9969O4ZG2L8MOsIjB9mKf8FAAD__yoz9j0">