This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR java/19277: Array.length++ is incorrectly allowed


On Mon, 10 Jan 2005 11:07:54 +0000, Andrew Haley <aph@redhat.com> wrote:
> 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.

Thanks for the quick review and approval!


>  >        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.  */

The thing is, the current GCJ *does* catch stuff like this:

class Foo
{
  final int bar = 10;
  void snafu( )
  {
    bar++;
  }
}

So should I say something like "Don't allow [...] on array length
fields"? Or "implicitly declared" ("artificial"?) fields?

Thanks,
Ranjit.

-- 
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]