It’s a compiler bug!!! Yes!! It is!! Seriously, it is!!!

Well… is it? Let’s have a look. What is going on with my RISCV debugging issue.
So, last time, I mentioned, a binary built with GCC 8 could be debugged fine with GDB,
however, building the same code with GCC 12 gave issues with GDB disagreeing about
the stack layout.

Next, I created a minimal test case, to be built with GCC12. Minimal code, including
the startup code. Disable all interrupts, no vector table, just to the minimal to boot.

And then, the problem was gone… but why? What was the difference. Next, I pulled the
same code through by build system, and there was the problem.

So… it seemed… it was something in my build system creating the issue.
The problem has to be in the parameters passed to the compiler while building.

I have traced the problem down to the generation of assembly listing when compiling a C file.
This is a parameter passed to the assembler, so technically, this ain’t a compiler bug.

See for an example how to reproduce these results.