<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153939>153939</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MC][ARM] `Clang` Crashes When Assembling Invalid ARM `ldrexd` Instructions with `--triple=armv8-none-eabi `
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
venkyqz
</td>
</tr>
</table>
<pre>
## Description
+ Pretty similar to this one #153938.
+ The root cause should be similar, a soundness problem in the assembler parser `ARMAsmParser::parseInstruction` / `ARMOperand::getReg`.
+ Expected behavior is to emit diagnostics (e.g., “invalid instruction”, “destination operands must be sequential”), not to crash.
---
## Interesting Facts
- **Clang 18.1.0**:
- Clang **18.1.0** with the same triple/inputs produces correct error messages and exits cleanly (**no crash**).
- This is the latest version that still works, indicating a bug introduced after 18.1.0.
- **ARM gcc 15.1**:
With `arm-linux-gnueabi-gcc -march=armv8-a`, GNU `as` correctly diagnoses the invalid instructions with errors such as:
- ARM register expected -- `ldaexd r0, h0, [r8]'
It does **not crash**.
---
## Steps to reproduce
+ This issue was reproduced in Compiler Explorer using `x86-64 Clang (trunk with assertions)`,`x86-64 Clang 18.1.0`, and `arm gcc 15.1`
+ Comprehensive reproduce link: [https://godbolt.org/z/YjhTYaoqY](https://godbolt.org/z/YjhTYaoqY)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMlUFzozgQhX-NfOmCwsIwcPAB2_FWDtmdymZrKkcBHdBESEQtHGd-_ZYEHnuyc9iqVFxG3eL1955kQSQ7jbhl2Y5lh5WYXG_s9oT69ePtx6o27ceW8ZTxFA5IjZWjk0azpPJ_fAdfLTr3ASQHqYQFZ8D1ksBoBMbTdZaWaRHDtf6pR7DGOGjERAjUm0m1UONlB8b3IIDMpFuNRDBaUyscQGpwPYIgwqFWaGEUltACy5Pq8aGi4Wv4ztKKpVV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