parse.y (end_artificial_method_body): Fixed undefined behavior.

2000-12-15  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (end_artificial_method_body): Fixed undefined behavior.
	Credits go to rth for finding it.

(http://gcc.gnu.org/ml/gcc/2000-12/msg00495.html)

From-SVN: r38278
This commit is contained in:
Alexandre Petit-Bianco 2000-12-15 08:50:12 +00:00 committed by Alexandre Petit-Bianco
parent 40244a2757
commit 1e0cdc1036
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2000-12-15 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (end_artificial_method_body): Fixed undefined behavior.
Credits go to rth for finding it.
2000-12-13 Mike Stump <mrs@wrs.com>
* parse.y (check_static_final_variable_assignment_flag): Fix spelling.

View File

@ -7200,7 +7200,11 @@ static void
end_artificial_method_body (mdecl)
tree mdecl;
{
BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
/* exit_block modifies DECL_FUNCTION_BODY (current_function_decl).
It has to be evaluated first. (if mdecl is current_function_decl,
we have an undefined behavior if no temporary variable is used.) */
tree b = exit_block ();
BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = b;
exit_block ();
}