From 930248932e3864264cdfe7d40b00a0544f3d4de9 Mon Sep 17 00:00:00 2001 From: Alexandre Petit-Bianco Date: Fri, 28 May 1999 19:26:08 +0000 Subject: [PATCH] [multiple changes] Fri May 28 18:22:45 1999 Alexandre Petit-Bianco * parse.y (lookup_field_wrapper): Unified returned value to NULL or the searched field decl. Fri May 28 11:34:05 1999 Alexandre Petit-Bianco * parse.y (fold_constant_for_init): Convert numerical constant values to the type of the assigned field. Thu May 27 19:57:40 1999 Alexandre Petit-Bianco * expr.c (lookup_field): Relaxed the test on class loading error detection. * parse.y (fold_constant_for_init): Enabeled old code. Wed May 26 18:06:02 1999 Alexandre Petit-Bianco * parse.y (valid_ref_assignconv_cast_p): Let `_Jv_CheckCast' decide the validity of the cast of a java.lang.Cloneable reference to an array. (patch_conditional_expr): Fixed first argument passed to binary_numeric_promotion. From-SVN: r27229 --- gcc/java/ChangeLog | 24 ++++++++++++++++++++++++ gcc/java/expr.c | 2 +- gcc/java/parse.c | 14 ++++++++------ gcc/java/parse.y | 14 ++++++++------ 4 files changed, 41 insertions(+), 13 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 72e8d180f77..35e7d99f966 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,27 @@ +Fri May 28 18:22:45 1999 Alexandre Petit-Bianco + + * parse.y (lookup_field_wrapper): Unified returned value to NULL + or the searched field decl. + +Fri May 28 11:34:05 1999 Alexandre Petit-Bianco + + * parse.y (fold_constant_for_init): Convert numerical constant + values to the type of the assigned field. + +Thu May 27 19:57:40 1999 Alexandre Petit-Bianco + + * expr.c (lookup_field): Relaxed the test on class loading error + detection. + * parse.y (fold_constant_for_init): Enabeled old code. + +Wed May 26 18:06:02 1999 Alexandre Petit-Bianco + + * parse.y (valid_ref_assignconv_cast_p): Let `_Jv_CheckCast' + decide the validity of the cast of a java.lang.Cloneable reference + to an array. + (patch_conditional_expr): Fixed first argument passed to + binary_numeric_promotion. + Wed May 26 15:33:06 1999 Alexandre Petit-Bianco * parse.y (qualify_ambiguous_name): Take into account that a diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 79d0b7bd67f..64651f5ddc7 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1162,7 +1162,7 @@ lookup_field (typep, name) if (CLASS_P (*typep) && !CLASS_LOADED_P (*typep)) { load_class (*typep, 1); - if (TREE_CODE (TYPE_SIZE (*typep)) == ERROR_MARK) + if (!TYPE_SIZE (*typep) || TREE_CODE (TYPE_SIZE (*typep)) == ERROR_MARK) return error_mark_node; } do diff --git a/gcc/java/parse.c b/gcc/java/parse.c index ba6ccf451a2..1606859213c 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -5666,7 +5666,7 @@ lookup_field_wrapper (class, name) java_parser_context_save_global (); decl = lookup_field (&type, name); java_parser_context_restore_global (); - return decl; + return decl == error_mark_node ? NULL : decl; } /* Find duplicate field within the same class declarations and report @@ -11682,7 +11682,8 @@ valid_ref_assignconv_cast_p (source, dest, cast) return source == dest || interface_of_p (dest, source); } else /* Array */ - return 0; + return (cast ? + (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0); } if (TYPE_ARRAY_P (source)) { @@ -14049,7 +14050,7 @@ patch_conditional_expr (node, wfl_cond, wfl_op1) /* Otherwise, binary numeric promotion is applied and the resulting type is the promoted type of operand 1 and 2 */ else - resulting_type = binary_numeric_promotion (t2, t2, + resulting_type = binary_numeric_promotion (t1, t2, &TREE_OPERAND (node, 1), &TREE_OPERAND (node, 2)); } @@ -14106,8 +14107,11 @@ fold_constant_for_init (node, context) tree op0, op1, val; enum tree_code code = TREE_CODE (node); - if (code == INTEGER_CST || code == REAL_CST || code == STRING_CST) + if (code == STRING_CST) return node; + + if (code == INTEGER_CST || code == REAL_CST) + return convert (TREE_TYPE (context), node); if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL) return NULL_TREE; @@ -14202,13 +14206,11 @@ fold_constant_for_init (node, context) } else { -#if 0 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */ qualify_ambiguous_name (node); if (resolve_field_access (node, &decl, NULL) && decl != NULL_TREE) return fold_constant_for_init (decl, decl); -#endif return NULL_TREE; } } diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 1f9e9957756..5a5c6744bd1 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -3081,7 +3081,7 @@ lookup_field_wrapper (class, name) java_parser_context_save_global (); decl = lookup_field (&type, name); java_parser_context_restore_global (); - return decl; + return decl == error_mark_node ? NULL : decl; } /* Find duplicate field within the same class declarations and report @@ -9097,7 +9097,8 @@ valid_ref_assignconv_cast_p (source, dest, cast) return source == dest || interface_of_p (dest, source); } else /* Array */ - return 0; + return (cast ? + (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0); } if (TYPE_ARRAY_P (source)) { @@ -11464,7 +11465,7 @@ patch_conditional_expr (node, wfl_cond, wfl_op1) /* Otherwise, binary numeric promotion is applied and the resulting type is the promoted type of operand 1 and 2 */ else - resulting_type = binary_numeric_promotion (t2, t2, + resulting_type = binary_numeric_promotion (t1, t2, &TREE_OPERAND (node, 1), &TREE_OPERAND (node, 2)); } @@ -11521,8 +11522,11 @@ fold_constant_for_init (node, context) tree op0, op1, val; enum tree_code code = TREE_CODE (node); - if (code == INTEGER_CST || code == REAL_CST || code == STRING_CST) + if (code == STRING_CST) return node; + + if (code == INTEGER_CST || code == REAL_CST) + return convert (TREE_TYPE (context), node); if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL) return NULL_TREE; @@ -11617,13 +11621,11 @@ fold_constant_for_init (node, context) } else { -#if 0 /* Wait until the USE_COMPONENT_REF re-write. FIXME. */ qualify_ambiguous_name (node); if (resolve_field_access (node, &decl, NULL) && decl != NULL_TREE) return fold_constant_for_init (decl, decl); -#endif return NULL_TREE; } }