aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>2001-02-19 21:10:14 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2001-02-19 21:10:14 +0000
commit35ab11f05fb3547f56cdadfed442a7e7d2e9f385 (patch)
tree248b78232c08b9685d46350e2b625d65a380d945 /gcc
parent7539316943c17368ce5ef876a9baba6b8c2e64f6 (diff)
downloadgcc-35ab11f05fb3547f56cdadfed442a7e7d2e9f385.zip
gcc-35ab11f05fb3547f56cdadfed442a7e7d2e9f385.tar.gz
gcc-35ab11f05fb3547f56cdadfed442a7e7d2e9f385.tar.bz2
typeck.c (build_java_array_type): Don't try to poke a public `clone' method into array types.
* typeck.c (build_java_array_type): Don't try to poke a public `clone' method into array types. * parse.y (patch_method_invocation): Bypass access check on clone call to array instance. From-SVN: r39906
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/parse.y12
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 848fd7c..f19c3ff 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2001-02-18 Bryce McKinlay <bryce@albatross.co.nz>
+
+ * typeck.c (build_java_array_type): Don't try to poke a public `clone'
+ method into array types.
+ * parse.y (patch_method_invocation): Bypass access check on clone call
+ to array instance.
+
2001-02-15 Alexandre Petit-Bianco <apbianco@redhat.com>
* expr.c (build_instanceof): Check for arrays when trying fold to
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index e70b2eb..cb8525a 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -9684,6 +9684,7 @@ patch_method_invocation (patch, primary, where, from_super,
int is_static_flag = 0;
int is_super_init = 0;
tree this_arg = NULL_TREE;
+ int is_array_clone_call = 0;
/* Should be overriden if everything goes well. Otherwise, if
something fails, it should keep this value. It stop the
@@ -9758,6 +9759,9 @@ patch_method_invocation (patch, primary, where, from_super,
else
this_arg = primary = resolved;
+ if (TYPE_ARRAY_P (type) && identifier == get_identifier ("clone"))
+ is_array_clone_call = 1;
+
/* IDENTIFIER_WFL will be used to report any problem further */
wfl = identifier_wfl;
}
@@ -9839,6 +9843,10 @@ patch_method_invocation (patch, primary, where, from_super,
can't be executed then. */
if (!list)
PATCH_METHOD_RETURN_ERROR ();
+
+ if (TYPE_ARRAY_P (class_to_search)
+ && DECL_NAME (list) == get_identifier ("clone"))
+ is_array_clone_call = 1;
/* Check for static reference if non static methods */
if (check_for_static_method_reference (wfl, patch, list,
@@ -9909,7 +9917,9 @@ patch_method_invocation (patch, primary, where, from_super,
return the call */
if (not_accessible_p (DECL_CONTEXT (current_function_decl), list,
(primary ? TREE_TYPE (TREE_TYPE (primary)) :
- NULL_TREE), from_super))
+ NULL_TREE), from_super)
+ /* Calls to clone() on array types are permitted as a special-case. */
+ && !is_array_clone_call)
{
char *fct_name = (char *) IDENTIFIER_POINTER (DECL_NAME (list));
char *access = java_accstring_lookup (get_access_flags_from_decl (list));