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

    <tr>
        <th>Summary</th>
        <td>
            Assembler silently truncates a const
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            inline-asm
      </td>
    </tr>

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

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

<pre>
    The code is:
```
asm("leaq 0xab12345678(%rax), %rax");
```

Clang 17.0.1 emits (note discarded high bytes):
```
lea 0x12345678(%rax),%rax
```
https://godbolt.org/z/9MY3jxKn6

Assembler should emit an error for non-representable encoding rather than silently truncate the code. This is painful to debug. The const may not be even spelled out, e.g. `leaq %c[foo](%rax), %rax`, and then silently break after code changes elsewhere.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0kk1vpDwQhH-NubQGmQbzceCQD3F59d5y2aONG3Bi7FnbzM7sr19BZrVRlEgIKHCXHrtKxmhmR9Qz8cjEcya3tPjQ68tte_OXTHl9618WgtFrAhNZ-cD4M-MPrOb365AyrgxbhmhJ_gR-larAshJ10x6fRZBXhh3DJ_grcNfl45du7_cnK90MRZPzvABaTYrAsHU-EWgTRxk0aVjMvIC6JYqH39d0liTw6zdE9_ev5paUzseWcWA4zF4rb1Puw8xw-M1w6P7_Ub5e_3P1R-yHGGlVlgLExW9WH-ggHVAIPsDkAzjvToHOgSK5JJUlIDd6bdwMQaaFAqRFOojGkkv2BilsbpSJIN2TyOFlMRFMhLM0btosJA-a1Dbvf_Y1LiZY5Q2cT6AI6EIO4pmsJQ1-S3sSlM85sJofkTEUIxOPk_dMPH-TWc13IZ3eOT7gqUDyDeSUKLz3ZFykmykC2Ui_FgqUZ7ovdVd2MqO-aHglBHZlky19pxucRM1V11Vt25XY1AI5p1ZMXVO0dWZ65FjxgtdFJUTZ5FiT6ioSchK8mMTIKk6rNDa39rLu4WQmxo36pkHOMysV2Xi0G9E4axydjrLi3vbQ70Mntc2RVdyamOI_m2SSpf5DnJ_jiCDfTzrbgu0_lcWkZVP56FeGw255f5zOwb_SmBgOB2ZkOBykfwIAAP__HzUVFg">