The following program:
void main() __naked
{
__asm
push af
push af' ; invalid
pop af
pop af' ; invalid
ex af, af ; invalid
ex af, af'
ex af', af ; invalid
ex af', af' ; invalid
__endasm;
}
accepts invalid instructions and generates the following opcodes:
0000 48 _main::
49 ;main.c:14: __endasm;
0000 F5 50 push af
0001 F5 51 push af' ; invalid
0002 F1 52 pop af
0003 F1 53 pop af' ; invalid
0004 08 54 ex af, af ; invalid
0005 08 55 ex af, af'
0006 08 56 ex af', af ; invalid
0007 08 57 ex af', af' ; invalid
58 ;main.c:15: }
The program was compiled with this command:
sdcc -mr3ka main.c
sdcc version is 4.2
The following patch fixes the problem for me. Could someone please review it to make sure I didn't miss anything?
Last edit: D-mo 2023-08-25
With this patch the compiler now correctly rejects five invalid instructions:
Thanks. Fixed in [r14320] by applying your patch.
Related
Commit: [r14320]