<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/122200>122200</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Intel Assembly Bugs (Mishandle Labels)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
witbring
</td>
</tr>
</table>
<pre>
I am reporting an assembly bug found during research.
The tests were conducted using the latest version (Clang 19.1.0)
The issue occurs in the same way with previous versions as well.
When some register names are used in operands, Clang interprets them as
actual registers. Notably, Clang allows the creation of these labels,
which could potentially lead to problems.
1. Example Code
```
.intel_syntax noprefix
.data
RAX:
RbX:
Rcx:
.long 0
.text
test:
mov edx, DWORD PTR [RAX]
mov edx, DWORD PTR [RbX]
mov edx, DWORD PTR [Rcx]
call rsP
rsP:
ret
```
2. Compilation Command
```
Clang -c test.c
```
3. Compiled Binary Output
```
0000000000000000 <test>:
0: 8b 10 mov edx,DWORD PTR [rax]
2: 8b 13 mov edx,DWORD PTR [rbx]
4: 8b 11 mov edx,DWORD PTR [rcx]
6: ff d4 call rsp
0000000000000008 <rsP>:
8: c3 ret
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMlNuOozgQhp_GuSk1MiYnLrigk4400u7OqDXS7N3K2AV4ZWzkQw5vvzKQjjY9q1kUCQf8f1X1lynuveoMYkU2r2RzXPEYeuuqiwqNU6ZbNVbeqi_AB3A4WheU6YAb4N7j0OgbNLGD1kYjQcYkAIceuRN9Rmj9vUcI6IOHCzoEYY2MIqCE6NPW0CNonjbAGZ1X1gBh-4PmpoO8zPKMElYuGOV9RLBCROdBmUnr-YBw4Te4qNDD6PCsbPR3lgee4mqdMiG0_tGjAW8HBIed8gEdGD6gB-4QokeZsHZEx430hB1gTkSZgG50GHyKOQD3hNZchMj1B8hn8IcNvNG3h45rbS-TBoRDHlJ1tk3_faq6QZ2CEFpfeiV6EDZqCaMNaILiWt9AI5cQLIzONhoHv5RBaJ1n8Hblw6gRDlbi8nxLlx-ts5S0_svfTOBXMHZ02KpreiF54ITW7_WfpEiq9-a-ENd5AQCQaWs6mEgBr4HQOjVpfk9oOdgzoSXKa6r2-OPr-xG-fX8HsnlN3M3xl7ua_7VLXOddILjW4Py3udC0-MjUYXiqndCaZXCww6j07PrBDgM38rNNc6NexHRGM_EZVNxBKOFVGe5u8DWGMYbPLPp0ASkOs2lvS7Z0upf7BnIKT9dsRFrNTvzLCMfvRgCwB6T4hap5qNYPVf4foX9GEA_Cdia0Lcj1TwhLh8bZlycr9smLqWtvH43bzzxRPMNm3lNbV7IqZFmUfIVVviu2xZ7t12zVV_l-XbbllrVrLpnY8TVuG4a7thUb2exwv1IVo2xDc1pSWqwpy3LG9kVDBc35rsXNlqwpDlzpTOvzkFnXraZJU-WMMUpX84c6DUfGRDovhLE0J12VBC9N7DxZU6188A9EUEFPE3U6YWRzhC_pg4T6PjVfY-fTrPtd-Z4bqRF-WyZCuYpOV30Io08WsRNhp06FPjaZsANhpxRkub2Mzv6NIhB2mpL2hJ2WvM8V-ycAAP__bES3jQ">