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

    <tr>
        <th>Summary</th>
        <td>
            clang miscompiles the example with __ptr32 attribute
        </td>
    </tr>

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

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

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

<pre>
    The executable got by building the example below crashes. Used clang15 (trunk) to compile the example.
Expected result:
11
11

`#include <stdio.h>

struct TEST_STRUCT {
    short       len;
    char        txt;
};

TEST_STRUCT a = {11, '0'};

typedef TEST_STRUCT* __ptr32 TEST_STRUCT_PTR;

void test_call(int c) {
  printf("%d\n", c);
}

int main() {
    test_call(((TEST_STRUCT_PTR)&a)->len);
    test_call(((TEST_STRUCT_PTR)&a)->len);
    return 0;
 }
`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU0tvozAQ_jXmYhWBCSQcOKRJ9rxq03PkxwTcOoDsoUn-_Q6k25DudS3LHvvzfPO06sy12jfA4QJ6QKkc8LpDrq5cDdYZ29YcJ1ieesIUuO7MtZehgRDztwCGayfbOs05Eyv0Q_vBRMmx47o79ZZUZuoxS7YsWe8uPWgkTQ9hcMiy9e0-TR_3r7VImMhsq91ggLNsE9DYLm5Ytps_C2RbI9_vXveH1_3L22bP2fL5hnEaoek88ttw0LJshulG-i-I4wW_Mbbc3uVpndNLcmY7GiF_xYbCX5Kjy3918NqDgePcNSbW_HDo0Wdifn34vX_5ofzZWcMRAh60dI5SbFvkekzxLLre0-2RQCYEE7lh-aadxM309CGeGfdIdZK2nRTLx3TNTd7mTz-JVxSStieqxJjRmaH_w-ABB9_y5H55D4CaYhIiU2WmzEoZoUUH1dSM_GTDV_uFh_Y9W2y-Ey8RvVUDQjR4VzWIfRhbUfyiWdPDQcVEQgfnPv9uT73v3ql56WhDGCCQkOd5kkVNtSy11HIlcqHLsizS1KRgUlkkSuVJslSRk_R9QsXyZypOC2c-UYyFyreRrUQiRJKnpLjIRRnDSi4KdUyhkEqZVcYWCVC1XDz6EXe-jnw1uaSGOhDobMBwB2UItm4BJnPELwekH1C10sOHbt6jyXY1-f4HyPcp4Q">