Page 1 of 1

PIC32 AI compiler S-reg swap bug on PIC32MZ

Posted: 28 Nov 2023 13:35
by Ilya K
The PIC32 AI compiler v3.0.0 (2022) generates the following code for PIC32MZ and then uses the registers S2 and S3 as if they were swapped, but the value in S2 is actually lost.

;Address Opcode ASM
0x9D0380AC 0x46001886 MOV.S S2, S3
0x9D0380B0 0x460010C6 MOV.S S3, S2

If the option -SSA is omitted, then these variables reside on stack and this error does not appear.