From patchwork Thu Aug 26 17:18:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 62792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1FA03B70DF for ; Fri, 27 Aug 2010 03:18:22 +1000 (EST) Received: (qmail 730 invoked by alias); 26 Aug 2010 17:18:21 -0000 Received: (qmail 715 invoked by uid 22791); 26 Aug 2010 17:18:19 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Aug 2010 17:18:11 +0000 Received: by vws13 with SMTP id 13so2015116vws.20 for ; Thu, 26 Aug 2010 10:18:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.60.204 with SMTP id q12mr6501046vch.183.1282843089990; Thu, 26 Aug 2010 10:18:09 -0700 (PDT) Received: by 10.220.78.193 with HTTP; Thu, 26 Aug 2010 10:18:09 -0700 (PDT) In-Reply-To: <20100826161919.A13913BE18@mailhost.lps.ens.fr> References: <20100826161919.A13913BE18@mailhost.lps.ens.fr> Date: Thu, 26 Aug 2010 10:18:09 -0700 Message-ID: Subject: Re: PING: PATCH: PR middle-end/45234: [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca From: "H.J. Lu" To: Dominique Dhumieres Cc: GCC Patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Thu, Aug 26, 2010 at 9:19 AM, Dominique Dhumieres wrote: > On x86_64-apple-darwin10.4.0 this patch caused the following failures: > FAIL: g++.dg/eh/async-unwind2.C execution test > FAIL: gcc.c-torture/execute/struct-ret-1.c execution,  -Os > FAIL: libgomp.c++/collapse-2.C  -O1  execution test > FAIL: libgomp.c++/for-1.C  -O1  execution test > FAIL: libgomp.c++/for-8.C  -O1  execution test > at r163063 and with -m32. > I need to take pending_stack_adjust into account. I am testing it on Linux/ia32 and Linux/x86-64. Can you try this new patch on Darwin? Thanks. diff --git a/gcc/calls.c b/gcc/calls.c index cd0d9c5..87b5808 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2377,6 +2377,19 @@ expand_call (tree exp, rtx target, int ignore) preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; + if (SUPPORTS_STACK_ALIGNMENT) + { + /* All variable sized adjustments must be multiple of preferred + stack boundary. Stack alignment may change preferred stack + boundary after variable sized adjustments have been made. We + need to compensate it here. */ + unsigned HOST_WIDE_INT delta + = ((stack_pointer_delta - pending_stack_adjust) + % preferred_unit_stack_boundary); + if (delta) + anti_adjust_stack (GEN_INT (preferred_unit_stack_boundary - delta)); + } + /* We want to make two insn chains; one for a sibling call, the other for a normal call. We will select one of the two chains after initial RTL generation is complete. */ --- /dev/null 2010-07-23 13:04:30.193381062 -0700 +++ gcc/gcc/testsuite/gcc.dg/torture/stackalign/alloca-5.c 2010-08-10 06:29:57.308629935 -0700 @@ -0,0 +1,32 @@ +/* PR middle-end/45234 */ +/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-m32 -mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */ + +#include "check.h" + +void +__attribute__ ((noinline)) +bar (__float128 f) +{ + check (&f, __alignof__(f)); +} + +int +main (void) +{ + char *p = __builtin_alloca (6); + + bar (0); + + __builtin_strncpy (p, "good", 5); + if (__builtin_strncmp (p, "good", 5) != 0) + { +#ifdef DEBUG + p[size] = '\0'; + printf ("Failed: %s != good\n", p); +#endif + abort (); + } + + return 0; +}