https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85669

--- Comment #32 from Wilco <wdijkstr at arm dot com> ---
(In reply to Segher Boessenkool from comment #29)
> It aligns the stack to 16:
> 
>       # r3 is size, at entry
>       addi r3,r3,18
>       ...
>       rlwinm r3,r3,0,0,27
>       ...
>       neg r3,r3
>       ...
>       lwz r2,0(r1)
>       ...
>       stwux r2,r1,r3
> 
> (the rlwinm is  r3 &= ~15;  )

So this rounds up the size but also adds an extra 16 bytes to the requested
allocation. The alloca blocks don't get correctly aligned since
STACK_DYNAMIC_OFFSET returns 72 (which is not a multiple of 16):

t1_a4
        addi r2,r1,72  -> 72 % 16 != 0 (correct value would be 64)
        stw r6,60(r1)
        stw r2,56(r1)

This also shows in t1/t2_a32:

        addi r2,r1,103  -> 31 + 72 = 103 (correct value would be 80+31)
        stw r6,64(r1)
        rlwinm r2,r2,0,0,26

So this proves STACK_DYNAMIC_OFFSET is incorrect indeed. If there are still
failures with that fixed then the stack pointer must also be unaligned.

Reply via email to