* 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)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38278
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
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 ();
}