Compilation of support/regression/tests/gcc-torture-execute-loop-5.c fails for ds390 in current (rev. #7116) svn ("Error: <p> phase error: label location changing between passes 2 and 3") . To reproduce: remove #if !defined(SDCC_ds390).
The ds390 code generator declares and uses a register with the name "_ap" which then clashes with the C source declaration of a function with the name "ap". The code generator also declares a register "ap" at the same address as "_ap". Probably we should eliminate the "_ap" definition to avoid the namespace clash, but I hesitate to change this without first understanding why this register is being declared in this unusual fashion.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think "_ap" is created as an alias for either ap on ds390 or r5 in bank 3 on tini native. The choice to add an underscore is a bad one. I suggest to rename "_ap" in the code generator to "a1" or "acc1" as it is used as some sort of secondary accumulator register. The underlying ap register is never used for its real purpose: 22-bit paged addressing mode "Address Page" as SDCC only supports 22-bit contiguous addressing mode.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The ds390 code generator declares and uses a register with the name "_ap" which then clashes with the C source declaration of a function with the name "ap". The code generator also declares a register "ap" at the same address as "_ap". Probably we should eliminate the "_ap" definition to avoid the namespace clash, but I hesitate to change this without first understanding why this register is being declared in this unusual fashion.
I think "_ap" is created as an alias for either ap on ds390 or r5 in bank 3 on tini native. The choice to add an underscore is a bad one. I suggest to rename "_ap" in the code generator to "a1" or "acc1" as it is used as some sort of secondary accumulator register. The underlying ap register is never used for its real purpose: 22-bit paged addressing mode "Address Page" as SDCC only supports 22-bit contiguous addressing mode.
Fixed in SDCC 3.3.2 #8936 by renaming _ap to acc1.