From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31828 invoked by alias); 2 Aug 2010 17:24:57 -0000 Received: (qmail 31817 invoked by uid 22791); 2 Aug 2010 17:24:56 -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_ZJ 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; Mon, 02 Aug 2010 17:24:45 +0000 Received: by qwg8 with SMTP id 8so1761263qwg.20 for ; Mon, 02 Aug 2010 10:24:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.43.163 with SMTP id w35mr1998707qae.92.1280769883485; Mon, 02 Aug 2010 10:24:43 -0700 (PDT) Received: by 10.229.24.203 with HTTP; Mon, 2 Aug 2010 10:24:43 -0700 (PDT) In-Reply-To: <4C56F982.2000908@redhat.com> References: <4C56F982.2000908@redhat.com> Date: Mon, 02 Aug 2010 17:24:00 -0000 Message-ID: Subject: Re: [PATCH, alpha]: Fix PR target/41089, stdarg pass produces wrong code From: Uros Bizjak To: Richard Henderson Cc: gcc-patches@gcc.gnu.org, Richard Guenther , Jakub Jelinek Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00072.txt.bz2 On Mon, Aug 2, 2010 at 6:59 PM, Richard Henderson wrote: >> As discussed in the PR, stdarg pass depends on number of assignments >> to ap.__offset location for correct operation. However, recent FRE/DCE >> enhancements remove one assignment as a dead code, causing the test >> failure: >> >> FAIL: gcc.c-torture/execute/stdarg-1.c execution, =A0-O3 -fomit-frame-po= inter >> FAIL: gcc.c-torture/execute/stdarg-1.c execution, =A0-O3 -g >> >> Attached patch marks __offset as volatile (suggested by Richi in >> comment #39), preventing optimizations that could otherwise confuse >> stdarg pass. >> >> 2010-08-01 =A0Uros Bizjak =A0 >> >> =A0 =A0 =A0 PR target/41089 >> =A0 =A0 =A0 * config/alpha/alpha.c (alpha_build_builtin_va_list): Mark _= _offset >> =A0 =A0 =A0 as volatile. >> >> Patch was bootstrapped and regression tested on >> alphaev68-pc-linux-gnu, where it fixes the failure. > > Ug. =A0That's awful. =A0It means that when you really do have dead code > it won't get deleted, and thus the stdarg pass won't be able to > eliminate the stores that could have been prevented. > > I'm tempted to say just remove the entire optimization, but what's > left after the volatile may be slightly better than no optimization > at all -- i.e. we can determine that there were never any va_arg > requests for double at all. > > So... patch ok. Thanks. I have committed the patch with a comment: Index: alpha.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- alpha.c (revision 162825) +++ alpha.c (working copy) @@ -5950,6 +5950,10 @@ integer_type_node); DECL_FIELD_CONTEXT (ofs) =3D record; DECL_CHAIN (ofs) =3D space; + /* ??? This is a hack, __offset is marked volatile to prevent + DCE that confuses stdarg optimization and results in + gcc.c-torture/execute/stdarg-1.c failure. See PR 41089. */ + TREE_THIS_VOLATILE (ofs) =3D 1; base =3D build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier ("__base"), Uros.