From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22279 invoked by alias); 26 Sep 2009 16:15:52 -0000 Received: (qmail 22173 invoked by uid 48); 26 Sep 2009 16:15:33 -0000 Date: Sat, 26 Sep 2009 16:15:00 -0000 Message-ID: <20090926161533.22170.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/40838] gcc shouldn't assume that the stack is aligned In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hjl dot tools at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg02418.txt.bz2 ------- 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