AVR - invalid assembler instruction compiles when it shouldn't
Original Reporter info from Mantis: ccrause @ccrause
-
Reporter name: Christo Crause
Original Reporter info from Mantis: ccrause @ccrause
- Reporter name: Christo Crause
Description:
The following assembler instruction is invalid and shouldn't compile:
cp R24, 8
since the cp instruction takes two registers as operands.
Steps to reproduce:
Compile the following program for AVR:
program AsmCompareCompileError;
begin
asm
cp R24, 8
end;
end.
The relevant disassembled code is as follows:
program AsmCompareCompileError;
begin
9e: 0e 94 54 00 call 0xa8 ; 0xa8 <FPC_INIT_FUNC_TABLE>
asm
cp R24, 8
a2: 88 15 cp r24, r8
end;
end.
a4: 0e 94 59 00 call 0xb2 ; 0xb2 <FPC_DO_EXIT>
The compiler substituted the integer 8 with register r8.
Additional information:
Cross compiler settings:
-Tembedded -Pavr -CpAVR5 -MObjFPC -Scghi -O3 -gw2 -godwarfsets -l -vewnhibq -Filib/avr-embedded -Fu. -FUlib/avr-embedded -Wpatmega328p -g -a -XPavr- -al -Sm -Si -dF_CPU:=16000000