clang generates an intruction that binutils doesn't understand
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Compile this function:
```c
unsigned long shr(unsigned long x)
{
return x >> 1;
}
```
with this command line: `clang-23 -m64 -O2 -mapxf -no-integrated-as -c shrq.c`
You get:
```
/tmp/shrq-9e6c3b.s: Assembler messages:
/tmp/shrq-9e6c3b.s:10: Error: operand type mismatch for `shr'
clang-23: error: assembler command failed with exit code 1 (use -v to see invocation)
```
The offending instruction is `{nf} shrq %rdi, %rax". It should be "{nf} shrq $1, %rdi, %rax`
Contributor guide
Research direction
Start by compiling the shown shrq.c function with clang-23 using the reported command line and inspect the emitted assembly, especially the offending `{nf} shrq` instruction. Done means the generated instruction uses the expected immediate operand and assembles successfully with binutils.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100