From patchwork Thu Sep 23 05:54:42 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: 65503 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 5BF74B6F06 for ; Thu, 23 Sep 2010 15:54:57 +1000 (EST) Received: (qmail 8007 invoked by alias); 23 Sep 2010 05:54:54 -0000 Received: (qmail 7998 invoked by uid 22791); 23 Sep 2010 05:54:51 -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; Thu, 23 Sep 2010 05:54:45 +0000 Received: by qwb7 with SMTP id 7so395155qwb.20 for ; Wed, 22 Sep 2010 22:54:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.121.222 with SMTP id i30mr64260vcr.155.1285221283026; Wed, 22 Sep 2010 22:54:43 -0700 (PDT) Received: by 10.220.202.9 with HTTP; Wed, 22 Sep 2010 22:54:42 -0700 (PDT) In-Reply-To: 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 22:54:42 -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 5:28 PM, H.J. Lu wrote: > On Wed, Sep 22, 2010 at 3:01 PM, H.J. Lu wrote: >> 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. >> >> -- >> H.J. >> --- >> gcc/ >> >> 2010-09-22  H.J. Lu   >> >>        PR middle-end/45234 >>        * calls.c (expand_call): Don't call check all variable sized >>        adjustments are multiple of preferred stack boundary after >>        stack alignment when calling builtin functions. >> >> gcc/testsuite/ >> >> 2010-09-22  Jakub Jelinek   >> >>        PR middle-end/45234 >>        * gcc.target/i386/pr45234.c: New. >> > > There are no regressions on trunk and 4.5. I configured > --with-arch=i586 for 32bit > gcc.  I am testing it on 4.4. > Here is the patch for 4.4. There are no regressions. OK for trunk/4.5/4.4? Thanks. diff --git a/gcc/calls.c b/gcc/calls.c index d85b70a..4e09cc2 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2374,7 +2374,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 diff --git a/gcc/expr.c b/gcc/expr.c index be332a7..d9463b4 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1443,6 +1443,7 @@ init_block_move_fn (const char *asmspec) NULL_TREE); fn = build_decl (FUNCTION_DECL, fn, args); + DECL_SOURCE_LOCATION (fn) = UNKNOWN_LOCATION; DECL_EXTERNAL (fn) = 1; TREE_PUBLIC (fn) = 1; DECL_ARTIFICIAL (fn) = 1; @@ -2713,6 +2714,7 @@ init_block_clear_fn (const char *asmspec) NULL_TREE); fn = build_decl (FUNCTION_DECL, fn, args); + DECL_SOURCE_LOCATION (fn) = UNKNOWN_LOCATION; DECL_EXTERNAL (fn) = 1; TREE_PUBLIC (fn) = 1; DECL_ARTIFICIAL (fn) = 1; --- /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])); +}