FAAAAAHHHH
it is currently 5 am.
i spent 2 hours debugging this single fibbonacci program.
because im developing arm64 support for my compiler and my processor is x86_64- i have to use an emulator
the process of debugging through an emulator is pure toture
- i have to run the emulator with a flag to make the program pause at start and be ready for gdb to attach at a specific port
- then i need to run a cross debugger and set the architecture to arm64
- then i need to connect to said port to start debugging the executable
the problem was this :
in my arm64 asm generator i accidentally swapped the w0 and w1 registers
w0 -is the right side of the expression
w1- is the left side of the expression
which i documented for myself at the head of this function:

so i was acc checking if w0<w1 (right<left)
instead of w1<w0 (left<right)
when checking “lower than” expression
(bug was also present in higher than expressions)
then it finally worked:

some other changes i made
fixed some other bugs i caught on static analysis relating to function prologues and epilogues