<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61030>61030</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-mc on rv64 gets confused by -mcpu=not-a-processor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Alcaro
</td>
</tr>
</table>
<pre>
Simply run `llvm-mc --arch=riscv64 -mcpu=not-a-processor /dev/null`, and you'll get a stack trace.
```
'not-a-processor' is not a recognized processor for this target (ignoring processor)
'not-a-processor' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: RV64 target requires an RV64 CPU
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-15.0.0/bin/llvm-mc -filetype=obj -o example.o --arch=riscv64 -mcpu=not-a-processor <source>
#0 0x000055b6be85d354 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x000055b6be85b034 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f837b712420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f837b1e500b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f837b1c4859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x000055b6be1bb801 (/opt/compiler-explorer/clang-15.0.0/bin/llvm-mc+0x485801)
#6 0x000055b6be80c86e (/opt/compiler-explorer/clang-15.0.0/bin/llvm-mc+0xad686e)
#7 0x000055b6be53065a (/opt/compiler-explorer/clang-15.0.0/bin/llvm-mc+0x7fa65a)
#8 0x000055b6be53c10f llvm::createRISCVAsmBackend(llvm::Target const&, llvm::MCSubtargetInfo const&, llvm::MCRegisterInfo const&, llvm::MCTargetOptions const&) (/opt/compiler-explorer/clang-15.0.0/bin/llvm-mc+0x80610f)
#9 0x000055b6be1c0d36 main (/opt/compiler-explorer/clang-15.0.0/bin/llvm-mc+0x48ad36)
#10 0x00007f837b1c6083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#11 0x000055b6be1f8d0e _start (/opt/compiler-explorer/clang-15.0.0/bin/llvm-mc+0x4c2d0e)
```
https://godbolt.org/z/1fWz9v4hh
Looks like that processor isn't ignored after all. I think it tries constructing a fallback processor, but said fallback is accidentally 32bit.
Arguably a garbage in garbage out, but it's also a PLEASE, so I might as well report it.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vl1v2zoS_TX0y8AGReqDfvCDm8TYAC0aJN3uo0FSY5kNRXpJKk366xeUksYK0L29bXEBG7Y45DnzpTmUMZrOIW5I9Y5Ulws5pKMPm63VMviF8u3T5s70J_sEYXBAamrtQ7_sNSyXMugj4ZfBRP1Ql7Ds9Wkg_NL5tJTLU_AaY_QBCNu1-EDYzg3WkpoSdgHStfDkB8Iaa6HDBBJikvoeUpAaV4ReErrNe6fP9MiaN9CENWAiOJ_PB9S-c-YbtvDKffAB0tFESDJkGsKE6ZwPxnVwBrP-pxjev__8Aa5ubz_eEr6F2891-XIu4H8HEzCCdNP6xc2_pzM376-2d1cQB9Wb7IYaOgh48iFB8nBM6RQJ3xK2I2zXmXQc1Er7nrBdrtTzT47oC-pE2M7EOGAkbDcWwThthxYhHRF0kPEISur78yrcjXVph_6UWcYluiJ0fRN8F2QPMnRDjy5lJ3Kt_SmzaN-fjMWwxMeT9QFDXrPSdcuiWtEVJWynjHvxLrfTwVhMTyck_NKrL7D0gI-yP1lc-b_Ra_wi-iFoJPxq8hUI4xToI6WUVpWqFYqq5VUJN8G4NAb3KUd7Zzon7b-ka212Vjx40xK2JWwNkymu9CmngI7f79jFG2xFeQlvwYxLfwnEnoGag-CNagpWMgr7fcCYfMB9GFsrJ8wownaPot7X5dIaNzwuOzdMhlM6BpTtKvqc4Xf0sShLRr93X6bhM5oCK0oVBGki_gS-zsj1iFxy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