[gccsdk] long long parameter + module code + tail calls + -Os generates broken stack code

Lee Noar lee.noar at sky.com
Thu Feb 4 09:18:10 PST 2021

On 03/02/2021 09:49, Rob Kendrick wrote:
> I have a problem where if I change any of the four things mentioned in the
> subject (ie, use a 32 bit int, don't pass -mmodule, use -O0 or -O2, etc) it
> vanishes.  With the combination, the code generated stacks every register in
> the preamble, but never unstacks them.  gas also complains that the writeback
> register is in the list (with good reason!)
> Might be some sort of bitmap signedness problem somewhere in the code
> generator?
> (The actual function I identified this on is much longer.  The only other
> simplification I could make and still produce the problem is to remove the
> final return statement, but that is included here.)

Unfortunately, I couldn't even get it to compile at all and got this

*** buffer overflow detected ***: terminated
testcase.c: In function 'write_long':
testcase.c:7:1: internal compiler error: Aborted

Looking at your assembler output, I can see that the epilogue is
correct, and that the prologue should match it.
I will look in to it.


More information about the gcc mailing list