Sorry..forgot to put the [PATCH] tag.
---------- Forwarded message ---------- From: Balaji V. Iyer <bvi...@gmail.com> Date: Sat, Jan 28, 2012 at 12:55 PM Subject: Re: [Bug c++/47791] finish function is using literal value instead of a #defined one To: 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 <bvi...@gmail.com> * 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 <gcc-bugzi...@gcc.gnu.org> wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47791 > > Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> 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