------- Comment #51 from hjl dot tools at gmail dot com 2009-09-26 16:15 ------- (In reply to comment #50) > > I am saying that the patch could be included in 4.4 as a quick fix and that > 4.5 > needs stack alignment redesign. You can't redesign it by incrementally testing > against a set of examples. You (or someone else) need to sit down, draft the > rules for propagation of preferred and enforced alignment across types down to > the stack frame and code it. If you understand what you're doing, you can > create test examples on your own. If you don't understand, then don't hack it > at all. >
The stack realignment works correctly as designed. The problems come from 1. Gcc generates code for 16byte-aligned incoming stack. 2. Gcc generates 16byte-aligned outgoing stack. 3. SSE variables segfault if they aren't 16byte aligned. 4. Some incoming stacks aren't aligned at 16byte, which violates #1 and may cause #3. We have to do #2 since many existing binaries need 16byte-aligned incoming stack. If we assume incoming stack is 4byte aligned, we have to realign stack for every function due to #2, which isn't acceptable. To accommodate #4, which isn't strictly required, and avoid #3 with minimum stack realignment, we need to list all #4 cases which lead to #3. Then we can investigate how to address them. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838