Error: Instruction using illegal Value.
Error: Instruction using illegal Value.
Does anyone know what “Error: Instruction using illegal Value.” means? I’m trying to assemble some asm function and I get this error. It doesn’t tell me what line the error is on, but by commenting and uncommenting sections of code, it seems to be “mov a, #31” as the cause of the problem, which doesn’t look illegal to me.
Here is the compiler flags that I’m using:
llvm-rl78/bin/clang.exe –target=rl78 -mcpu=s3 -Og -g -ffunction-sections -fdata-sections -fno-strict-aliasing -Wall -Wextra -Wno-pointer-sign -Wno-sign-compare -x assembler-with-cpp -MMD -MP -MF OUTPUT/printf.d -MT OUTPUT/printf.o -c printf.S -o OUTPUT/printf.o
Error: Instruction using illegal Value.
LLVM for Renesas RL78 17.0.1.202412 (d8f0f7bcd) clang version 17.0.1
Target: rl78-unknown-elf
Thread model: posix
InstalledDir: C:\ProgramData\LLVM for Renesas RL78 17.0.1.202412\bin
Hello,
Thank you for providing the source file!
The issue seems to be the last instruction
bz $formatStringNextChar
The $addr20 address is PC relative, where the new PC will be equal to PC + 2 + jdisp8, the jdisp8 value being signed 8-bit data.
This last jump is outside of the allowed range, thus the compiler generates the error. We recommend re-writing it like so:
sknz br !formatStringNextChar
It is difficult to debug the exact cause of this issue, since the error does not contain the line it occurred, but this will be improved upon in a future release.
Please let us know if we can be of assistance with any other issues.
Best regards,
The Open Source Tools Team

日本語
I installed the latest version 17.0.1.202506 and it still has the same issue.
Hello,
Thank you for reaching out to us!
Since “mov a, #31” is indeed a valid instruction and using just this instruction in an assembly file does not produce any errors, we kindly ask you to attach the entire source file which reproduces the issue.
Thank you!
Best regards,
The Open Source Tools Team
I don’t see an attachment option on the website, but you can download it from here:
https://ln5.sync.com/4.0/dl/b2f72d3e0#b5dfxzuz-kxdhdywj-874amrz3-bifranw5
I use this command to assemble it:
clang.exe –target=rl78 -mcpu=s3 -Og -g -ffunction-sections -fdata-sections -fno-strict-aliasing -Wall -Wextra -Wno-pointer-sign -Wno-sign-compare
-x assembler-with-cpp -MMD -MP -MF printf.d -MT printf.o -c printf.S -o printf.o
which gives me this message:
Error: Instruction using illegal Value.