From patchwork Sat Jan 28 17:55:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Balaji V. Iyer" X-Patchwork-Id: 138400 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 E4DF5B6EEC for ; Sun, 29 Jan 2012 04:56:04 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1328378165; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=5LPXI4DQAhxPDgNWdWqGVK9kBGY=; b=XhTLt28gS/+ibHN 0qHpV4JGCREDrXRP7AfqD/qMgHcyrb9JIV/UVdrBqOZDpXXaUMK+bEzrmUXDLmTe aLfYso2s8jSlLF9UbzDWNF6JhIIt4SWKDQ9JiarWuOwigz9ORRES6uG6U75yhjsQ mM5HzYAWbg1bYRYsrYHsMELR/2vQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=puRFEHm4ljOxbf0V93fq6x6ErD/UDdW7HEtMUXrTiZ85OICZTxWJUJIX9Fc0tv o5xQdpRNK+XdysRE/8tMiltOU+JguiUHUbXZ323O6WcemFjQwchZVAfU+uv6qCvs yey9Y1BuzGNciPo9hrTVcxNy9I0xIZjLMxa5KcUGuOsfY=; Received: (qmail 656 invoked by alias); 28 Jan 2012 17:56:00 -0000 Received: (qmail 317 invoked by uid 22791); 28 Jan 2012 17:55:58 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vx0-f175.google.com (HELO mail-vx0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 Jan 2012 17:55:44 +0000 Received: by vcbfk26 with SMTP id fk26so2021148vcb.20 for ; Sat, 28 Jan 2012 09:55:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.148.138 with SMTP id p10mr6036932vcv.28.1327773344088; Sat, 28 Jan 2012 09:55:44 -0800 (PST) Received: by 10.52.88.140 with HTTP; Sat, 28 Jan 2012 09:55:44 -0800 (PST) In-Reply-To: References: Date: Sat, 28 Jan 2012 12:55:44 -0500 Message-ID: Subject: Re: [Bug c++/47791] finish function is using literal value instead of a #defined one From: "Balaji V. Iyer" To: gcc-patches@gcc.gnu.org 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 Hello Everyone, Here is a patch to fix this bug. Please let me know if it is OK for me to commit this into trunk. Here is the Changelog entry: ======================================================= 2012-01-28 Balaji V. Iyer * optimize.c (maybe_clone_body): Replace '0' in finish_function parameter with "FF_DEFAULT." * decl.c (end_cleanup_fn): Likewise. * method.c (synthesize_method): Likewise. * pt.c (instantiate_decl): Likewise. * decl2.c (finish_objects): Likewise. (finish_static_storage_duration_function): Likewise. * parser.c (cp_parser_lambda_body): Replaced all occurances of '0', '1', and '2' in finish_function parameters with "FF_DEFAULT," "FF_PRE_PARSED," and "FF_INCLASS_INLINE," respectively. * semantics.c (maybe_add_lambda_conv_op): Replaced '2' in finish_function with "FF_INCLASS_INLINE." * cp-tree.h: Added FF_DEFAULT, FF_PRE_PARSED and FF_INCLASS_INLINE. ======================================================== Thanks, Balaji V. Iyer. On Sat, Jan 28, 2012 at 12:56 AM, pinskia at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47791 > > Andrew Pinski changed: > >           What    |Removed                     |Added > ---------------------------------------------------------------------------- >             Status|UNCONFIRMED                 |NEW >   Last reconfirmed|                            |2012-01-28 >            Summary|finish function is using    |finish function is using >                   |absolute value instead of   |literal value instead of a >                   |the #defined one            |#defined one >     Ever Confirmed|0                           |1 > > --- Comment #2 from Andrew Pinski 2012-01-28 05:56:07 UTC --- > Confirmed, > > -- > Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug. Index: cp/optimize.c =================================================================== --- cp/optimize.c (revision 183668) +++ cp/optimize.c (working copy) @@ -415,7 +415,7 @@ cp_function_chain->can_throw = !TREE_NOTHROW (fn); /* Now, expand this function into RTL, if appropriate. */ - finish_function (0); + finish_function (FF_DEFAULT); BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn); if (alias) { Index: cp/decl.c =================================================================== --- cp/decl.c (revision 183668) +++ cp/decl.c (working copy) @@ -6592,7 +6592,7 @@ static void end_cleanup_fn (void) { - expand_or_defer_fn (finish_function (0)); + expand_or_defer_fn (finish_function (FF_DEFAULT)); pop_from_top_level (); } Index: cp/method.c =================================================================== --- cp/method.c (revision 183668) +++ cp/method.c (working copy) @@ -771,7 +771,7 @@ } finish_function_body (stmt); - expand_or_defer_fn (finish_function (0)); + expand_or_defer_fn (finish_function (FF_DEFAULT)); input_location = save_input_location; Index: cp/pt.c =================================================================== --- cp/pt.c (revision 183668) +++ cp/pt.c (working copy) @@ -18750,7 +18750,7 @@ local_specializations = saved_local_specializations; /* Finish the function. */ - d = finish_function (0); + d = finish_function (FF_DEFAULT); expand_or_defer_fn (d); } Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 183668) +++ cp/semantics.c (working copy) @@ -9332,7 +9332,7 @@ finish_compound_stmt (compound_stmt); finish_function_body (body); - expand_or_defer_fn (finish_function (2)); + expand_or_defer_fn (finish_function (SF_INCLASS_INLINE)); /* Generate the body of the conversion op. */ @@ -9346,7 +9346,7 @@ finish_compound_stmt (compound_stmt); finish_function_body (body); - expand_or_defer_fn (finish_function (2)); + expand_or_defer_fn (finish_function (FF_INCLASS_INLINE)); if (nested) pop_function_context (); Index: cp/decl2.c =================================================================== --- cp/decl2.c (revision 183668) +++ cp/decl2.c (working copy) @@ -2833,7 +2833,7 @@ /* Finish up. */ finish_compound_stmt (body); - fn = finish_function (0); + fn = finish_function (FF_DEFAULT); if (method_type == 'I') { @@ -2975,7 +2975,7 @@ { /* Close out the function. */ finish_compound_stmt (body); - expand_or_defer_fn (finish_function (0)); + expand_or_defer_fn (finish_function (FF_DEFAULT)); } /* Return the information about the indicated PRIORITY level. If no Index: cp/parser.c =================================================================== --- cp/parser.c (revision 183668) +++ cp/parser.c (working copy) @@ -8559,7 +8559,7 @@ finish_lambda_scope (); /* Finish the function and generate code for it if necessary. */ - expand_or_defer_fn (finish_function (/*inline*/2)); + expand_or_defer_fn (finish_function (/*inline*/ FF_INCLASS_INLINE)); } parser->local_variables_forbidden_p = local_variables_forbidden_p; @@ -21045,8 +21045,8 @@ finish_lambda_scope (); /* Finish the function. */ - fn = finish_function ((ctor_initializer_p ? 1 : 0) | - (inline_p ? 2 : 0)); + fn = finish_function ((ctor_initializer_p ? FF_PRE_PARSED : FF_DEFAULT) | + (inline_p ? FF_INCLASS_INLINE : FF_DEFAULT)); /* Generate code for it, if necessary. */ expand_or_defer_fn (fn); /* Restore the saved values. */ Index: cp/cp-tree.h =================================================================== --- cp/cp-tree.h (revision 183668) +++ cp/cp-tree.h (working copy) @@ -4488,6 +4488,12 @@ #define SF_INCLASS_INLINE 2 /* The function is an inline, defined in the class body. */ +/* Used with finish function */ +#define FF_DEFAULT 0 +#define FF_PRE_PARSED 1 +#define FF_INCLASS_INLINE 2 + + /* Used with start_decl's initialized parameter. */ #define SD_UNINITIALIZED 0 #define SD_INITIALIZED 1