This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR java/19277: Array.length++ is incorrectly allowed
- From: Andrew Haley <aph at redhat dot com>
- To: Ranjit Mathew <rmathew at gmail dot com>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 10 Jan 2005 11:07:54 +0000
- Subject: Re: PR java/19277: Array.length++ is incorrectly allowed
- References: <41E2601E.6030601@gmail.com>
Ranjit Mathew writes:
> from Ranjit Mathew <rmathew@hotmail.com>
>
> PR java/19277
> * check-init.c (check_init): Take care of references that do not
> have an explicit final variable declaration (e.g. array length
> access) for pre/post in/de-crement operators.
OK.
>
> Index: check-init.c
> ===================================================================
> --- check-init.c 2005-01-10 13:04:36.000000000 +0530
> +++ check-init.c 2005-01-10 16:24:11.000000000 +0530
> @@ -833,5 +833,11 @@ check_init (tree exp, words before)
> tmp = get_variable_decl (TREE_OPERAND (exp, 0));
> if (tmp != NULL_TREE && DECL_FINAL (tmp))
> - final_assign_error (DECL_NAME (tmp));
> + final_assign_error (DECL_NAME (tmp));
> + else if (TREE_CODE (tmp = TREE_OPERAND (exp, 0)) == COMPONENT_REF)
> + {
Please add a small comment to say what this is for.
Like '* Don't allow pre/post in/de-crement operators on final fields. */
Thanks,
Andrew.