> No, the stack never gets misaligned - my patch doesn't change that at all.
Yes, it does. Dynamic allocation works like this: the amount to be allocated is added to VIRTUAL_STACK_DYNAMIC_REGNUM and the result is then dynamically aligned. Your patch assumes that VIRTUAL_STACK_DYNAMIC_REGNUM is as aligned as the stack pointer, i.e. STACK_BOUNDARY, but that's wrong for 32-bit SPARC at least (that's why I put the ??? note at line 5746 in emit-rtl.c). The previous attempt by Dominic Vogt was more correct in this respect: 2016-08-23 Dominik Vogt <v...@linux.vnet.ibm.com> * explow.c (get_dynamic_stack_size): Take known alignment of stack pointer + STACK_DYNAMIC_OFFSET into account when calculating the size needed. since it was using the declared alignment of VIRTUAL_STACK_DYNAMIC_REGNUM and not STACK_BOUNDARY directly. But the outcome was the same, since the declared alignment is still wrong for 32-bit SPARC. > The issue is that Sparc backend doesn't correctly set STACK_BOUNDSARY and > neither aligns the outgoing args. Run my test which proves alloca was > broken before my patch. How could this have been broken for so long, realistically? The SPARC back- end is parameterized according to the ABI and the documented interface between middle-end and back-end. -- Eric Botcazou