From patchwork Wed Sep 22 22:01:49 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: 65461 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 525C0B70DB for ; Thu, 23 Sep 2010 08:02:04 +1000 (EST) Received: (qmail 28108 invoked by alias); 22 Sep 2010 22:02:00 -0000 Received: (qmail 28092 invoked by uid 22791); 22 Sep 2010 22:01:59 -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, TW_FN X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Sep 2010 22:01:52 +0000 Received: by qwb7 with SMTP id 7so181927qwb.20 for ; Wed, 22 Sep 2010 15:01:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.169.14 with SMTP id w14mr442084vcy.157.1285192910031; Wed, 22 Sep 2010 15:01:50 -0700 (PDT) Received: by 10.220.202.9 with HTTP; Wed, 22 Sep 2010 15:01:49 -0700 (PDT) In-Reply-To: <20100922164721.GZ1269@tyan-ft48-01.lab.bos.redhat.com> References: <20100826161919.A13913BE18@mailhost.lps.ens.fr> <4C97C191.1080003@redhat.com> <201009212130.16431.ebotcazou@adacore.com> <20100922164721.GZ1269@tyan-ft48-01.lab.bos.redhat.com> Date: Wed, 22 Sep 2010 15:01:49 -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: Jakub Jelinek Cc: Eric Botcazou , Richard Henderson , gcc-patches@gcc.gnu.org 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 Wed, Sep 22, 2010 at 9:47 AM, Jakub Jelinek wrote: > On Tue, Sep 21, 2010 at 09:30:16PM +0200, Eric Botcazou wrote: >> > > OK to backport it to 4.4/4.5 branches? >> > >> > Yeah, sure. >> >> This badly breaks on i586 though.  On the 4.5 branch: > > Here is a shorter testcase: > > /* { dg-do compile } */ > /* { dg-options "-march=i586" { target ilp32 } } */ > > struct S { union { double b[4]; } a[18]; } s, a[5]; > void foo (struct S); > struct S bar (struct S, struct S *, struct S); > > void > foo (struct S arg) > { > } > > void > baz (void) > { >  foo (bar (s, &a[1], a[2])); > } > > Unless this is resolved soon, I think the 4.5/4.4 backports of this patch > should be reverted. I am testing this patch on trunk and 4.5. diff --git a/gcc/calls.c b/gcc/calls.c index aef823f..0c7588a 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2369,7 +2369,7 @@ expand_call (tree exp, rtx target, int ignore) preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; - if (SUPPORTS_STACK_ALIGNMENT) + if (SUPPORTS_STACK_ALIGNMENT && fndecl && !DECL_IS_BUILTIN (fndecl)) { /* All variable sized adjustments must be multiple of preferred stack boundary. Stack alignment may change preferred stack --- /dev/null 2010-09-09 09:16:30.485584932 -0700 +++ gcc-release/gcc/testsuite/gcc.target/i386/pr45234.c 2010-09-22 13:34:53.415871265 -0700 @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=i586" { target ilp32 } } */ + +struct S { union { double b[4]; } a[18]; } s, a[5]; +void foo (struct S); +struct S bar (struct S, struct S *, struct S); + +void +foo (struct S arg) +{ +} + +void +baz (void) +{ + foo (bar (s, &a[1], a[2])); +}