Commit 1729c265 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

re GNATS gcj/108 (Compiler doesn't check access modifiers on interface implementations)

2000-03-07  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* java-tree.h (IS_INIT_CHECKED): New flag.
	* check-init.c (check_init): Test and set IS_INIT_CHECKED.
	* parse.y (patch_string): Call force_evaluation_order on the
	completed string concatenation tree.
	* expr.c (force_evaluation_order): Call force_evaluation_order on
        function's arguments too.

(This fixes the Java PR #108:
 http://sourceware.cygnus.com/ml/java-prs/1999-q4/msg00174.html)

From-SVN: r32391
parent b0699dad
2000-03-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
* java-tree.h (IS_INIT_CHECKED): New flag.
* check-init.c (check_init): Test and set IS_INIT_CHECKED.
* parse.y (patch_string): Call force_evaluation_order on the
completed string concatenation tree.
* expr.c (force_evaluation_order): Call force_evaluation_order on
function's arguments too.
Mon Mar 6 18:07:07 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Mon Mar 6 18:07:07 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* decl.c (emit_init_test_initialization): Mark KEY as unused. * decl.c (emit_init_test_initialization): Mark KEY as unused.
......
...@@ -611,7 +611,6 @@ check_init (exp, before) ...@@ -611,7 +611,6 @@ check_init (exp, before)
case FIX_TRUNC_EXPR: case FIX_TRUNC_EXPR:
case INDIRECT_REF: case INDIRECT_REF:
case ADDR_EXPR: case ADDR_EXPR:
case SAVE_EXPR:
case PREDECREMENT_EXPR: case PREDECREMENT_EXPR:
case PREINCREMENT_EXPR: case PREINCREMENT_EXPR:
case POSTDECREMENT_EXPR: case POSTDECREMENT_EXPR:
...@@ -622,6 +621,13 @@ check_init (exp, before) ...@@ -622,6 +621,13 @@ check_init (exp, before)
exp = TREE_OPERAND (exp, 0); exp = TREE_OPERAND (exp, 0);
goto again; goto again;
case SAVE_EXPR:
if (IS_INIT_CHECKED (exp))
return;
IS_INIT_CHECKED (exp) = 1;
exp = TREE_OPERAND (exp, 0);
goto again;
case COMPOUND_EXPR: case COMPOUND_EXPR:
case PLUS_EXPR: case PLUS_EXPR:
case MINUS_EXPR: case MINUS_EXPR:
......
...@@ -2749,7 +2749,7 @@ force_evaluation_order (node) ...@@ -2749,7 +2749,7 @@ force_evaluation_order (node)
for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1); for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1);
arg; arg = TREE_CHAIN (arg)) arg; arg = TREE_CHAIN (arg))
{ {
tree saved = save_expr (TREE_VALUE (arg)); tree saved = save_expr (force_evaluation_order (TREE_VALUE (arg)));
cmp = (cmp == NULL_TREE ? saved : cmp = (cmp == NULL_TREE ? saved :
build (COMPOUND_EXPR, void_type_node, cmp, saved)); build (COMPOUND_EXPR, void_type_node, cmp, saved));
TREE_VALUE (arg) = saved; TREE_VALUE (arg) = saved;
......
...@@ -58,6 +58,7 @@ struct JCF; ...@@ -58,6 +58,7 @@ struct JCF;
5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE) 5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE)
IS_BREAK_STMT_P (in EXPR_WITH_FILE_LOCATION) IS_BREAK_STMT_P (in EXPR_WITH_FILE_LOCATION)
IS_CRAFTED_STRING_BUFFER_P (in CALL_EXPR) IS_CRAFTED_STRING_BUFFER_P (in CALL_EXPR)
IS_INIT_CHECKED (in SAVE_EXPR)
6: CAN_COMPLETE_NORMALLY (in statement nodes). 6: CAN_COMPLETE_NORMALLY (in statement nodes).
Usage of TYPE_LANG_FLAG_?: Usage of TYPE_LANG_FLAG_?:
...@@ -869,6 +870,10 @@ extern tree *type_map; ...@@ -869,6 +870,10 @@ extern tree *type_map;
/* True if EXPR (a CALL_EXPR in that case) is a crafted StringBuffer */ /* True if EXPR (a CALL_EXPR in that case) is a crafted StringBuffer */
#define IS_CRAFTED_STRING_BUFFER_P(EXPR) TREE_LANG_FLAG_5 (EXPR) #define IS_CRAFTED_STRING_BUFFER_P(EXPR) TREE_LANG_FLAG_5 (EXPR)
/* True if EXPR (a SAVE_EXPR in that case) had its content already
checked for (un)initialized local variables. */
#define IS_INIT_CHECKED(EXPR) TREE_LANG_FLAG_5 (EXPR)
/* If set in CALL_EXPR, the receiver is 'super'. */ /* If set in CALL_EXPR, the receiver is 'super'. */
#define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR) #define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR)
......
...@@ -12963,6 +12963,8 @@ patch_string (node) ...@@ -12963,6 +12963,8 @@ patch_string (node)
/* Temporary disable forbid the use of `this'. */ /* Temporary disable forbid the use of `this'. */
ctxp->explicit_constructor_p = 0; ctxp->explicit_constructor_p = 0;
ret = java_complete_tree (make_qualified_primary (node, invoke, 0)); ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
/* String concatenation arguments must be evaluated in order too. */
ret = force_evaluation_order (ret);
/* Restore it at its previous value */ /* Restore it at its previous value */
ctxp->explicit_constructor_p = saved; ctxp->explicit_constructor_p = saved;
return ret; return ret;
......
...@@ -10273,6 +10273,8 @@ patch_string (node) ...@@ -10273,6 +10273,8 @@ patch_string (node)
/* Temporary disable forbid the use of `this'. */ /* Temporary disable forbid the use of `this'. */
ctxp->explicit_constructor_p = 0; ctxp->explicit_constructor_p = 0;
ret = java_complete_tree (make_qualified_primary (node, invoke, 0)); ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
/* String concatenation arguments must be evaluated in order too. */
ret = force_evaluation_order (ret);
/* Restore it at its previous value */ /* Restore it at its previous value */
ctxp->explicit_constructor_p = saved; ctxp->explicit_constructor_p = saved;
return ret; return ret;
......
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