Commit 37a08adb by Per Bothner

typeck.c (convert_ieee_real_to_integer): Use save_expr instead of explicit build_decl.

�
	* typeck.c (convert_ieee_real_to_integer):  Use save_expr instead of
	explicit build_decl.  (Avoids crash in reload when optimizing.)
	* decl.c (complete_start_java_method):  Handle synchronized method
	even when compiling from bytecode.

From-SVN: r25468
parent 686fb236
...@@ -1514,12 +1514,19 @@ complete_start_java_method (fndecl) ...@@ -1514,12 +1514,19 @@ complete_start_java_method (fndecl)
expand_expr_stmt (init); expand_expr_stmt (init);
} }
if (METHOD_SYNCHRONIZED (fndecl) && ! flag_emit_class_files /* Push local variables. Function compiled from source code are
&& DECL_FUNCTION_BODY (fndecl) != NULL_TREE) using a different local variables management, and for them,
pushlevel shouldn't be called from here. */
if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (fndecl)))
{
pushlevel (2);
if (! flag_emit_class_files)
expand_start_bindings (1);
}
if (METHOD_SYNCHRONIZED (fndecl) && ! flag_emit_class_files)
{ {
/* Warp function body with a monitorenter plus monitorexit cleanup. */ /* Warp function body with a monitorenter plus monitorexit cleanup. */
tree function_body = DECL_FUNCTION_BODY (fndecl);
tree body = BLOCK_EXPR_BODY (function_body);
tree enter, exit, lock; tree enter, exit, lock;
if (METHOD_STATIC (fndecl)) if (METHOD_STATIC (fndecl))
lock = build_class_ref (DECL_CONTEXT (fndecl)); lock = build_class_ref (DECL_CONTEXT (fndecl));
...@@ -1527,24 +1534,24 @@ complete_start_java_method (fndecl) ...@@ -1527,24 +1534,24 @@ complete_start_java_method (fndecl)
lock = DECL_ARGUMENTS (fndecl); lock = DECL_ARGUMENTS (fndecl);
BUILD_MONITOR_ENTER (enter, lock); BUILD_MONITOR_ENTER (enter, lock);
BUILD_MONITOR_EXIT (exit, lock); BUILD_MONITOR_EXIT (exit, lock);
lock = build (WITH_CLEANUP_EXPR, void_type_node, if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (fndecl)))
enter, NULL_TREE, exit); {
TREE_SIDE_EFFECTS (lock) = 1; expand_expr_stmt (enter);
lock = build (COMPOUND_EXPR, TREE_TYPE (body), lock, body); expand_decl_cleanup (NULL_TREE, exit);
TREE_SIDE_EFFECTS (lock) = 1; }
lock = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (body), lock); else
TREE_SIDE_EFFECTS (lock) = 1; {
BLOCK_EXPR_BODY (function_body) = lock; tree function_body = DECL_FUNCTION_BODY (fndecl);
} tree body = BLOCK_EXPR_BODY (function_body);
lock = build (WITH_CLEANUP_EXPR, void_type_node,
/* Push local variables. Function compiled from source code are enter, NULL_TREE, exit);
using a different local variables management, and for them, TREE_SIDE_EFFECTS (lock) = 1;
pushlevel shouldn't be called from here. */ lock = build (COMPOUND_EXPR, TREE_TYPE (body), lock, body);
if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (fndecl))) TREE_SIDE_EFFECTS (lock) = 1;
{ lock = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (body), lock);
pushlevel (2); TREE_SIDE_EFFECTS (lock) = 1;
if (! flag_emit_class_files) BLOCK_EXPR_BODY (function_body) = lock;
expand_start_bindings (1); }
} }
} }
......
...@@ -67,23 +67,12 @@ convert_ieee_real_to_integer (type, expr) ...@@ -67,23 +67,12 @@ convert_ieee_real_to_integer (type, expr)
tree type, expr; tree type, expr;
{ {
tree node, assignment, expr_decl; tree node, assignment, expr_decl;
expr = save_expr (expr);
expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr)); return build (COND_EXPR, type,
layout_decl (expr_decl, 0); build (NE_EXPR, boolean_type_node, expr, expr),
expand_decl (pushdecl (expr_decl)); convert (type, integer_zero_node),
assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr); convert_to_integer (type, expr));
TREE_SIDE_EFFECTS (assignment) = 1;
TREE_TYPE (assignment) = type;
expr = build (COMPOUND_EXPR, NULL_TREE,
assignment,
build (COND_EXPR, type,
build (NE_EXPR, boolean_type_node, expr_decl, expr_decl),
build_int_2 (0, 0),
convert_to_integer (type, expr_decl)));
TREE_TYPE (expr) = type;
return expr;
} }
/* Create an expression whose value is that of EXPR, /* Create an expression whose value is that of EXPR,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment