public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/19277] New: allows array.length++ although it is final
@ 2005-01-05 19:50 kon at iki dot fi
  2005-01-05 20:39 ` [Bug java/19277] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: kon at iki dot fi @ 2005-01-05 19:50 UTC (permalink / raw)
  To: java-prs

GCC checked out on 2005-01-03 compiles the following code without
complaint, using the command line "gcj -C -Wall -W -pedantic
ArrayLength.java":

class ArrayLength {
    static int extend(int[] array) {
        /* array.length = 1; */
        array.length++;
        return array.length;
    }
}

It generates the following bytecode for the method:

  0: aload_0
  1: dup
  2: getfield <Field [I.length int>
  5: iconst_1
  6: iadd
  7: putfield <Field [I.length int>
 10: aload_0
 11: arraylength
 12: ireturn

However, if I uncomment the first assignment, I get this error:

ArrayLength.java: In class 'ArrayLength':
ArrayLength.java: In method 'ArrayLength.extend(int[])':
ArrayLength.java:3: error: Can't reassign a value to the final variable 'length'.
        array.length = 1;
  ^
1 error

I think it is inconsistent to allow ++ if the field is final.

-- 
           Summary: allows array.length++ although it is final
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kon at iki dot fi
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19277


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug java/19277] allows array.length++ although it is final
  2005-01-05 19:50 [Bug java/19277] New: allows array.length++ although it is final kon at iki dot fi
@ 2005-01-05 20:39 ` pinskia at gcc dot gnu dot org
  2005-01-10 11:02 ` rmathew at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-05 20:39 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-05 20:39 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.0.4 3.3.3 3.4.0 4.0.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-05 20:39:14
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19277


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug java/19277] allows array.length++ although it is final
  2005-01-05 19:50 [Bug java/19277] New: allows array.length++ although it is final kon at iki dot fi
  2005-01-05 20:39 ` [Bug java/19277] " pinskia at gcc dot gnu dot org
@ 2005-01-10 11:02 ` rmathew at gcc dot gnu dot org
  2005-01-10 18:01 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2005-01-10 11:02 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From rmathew at gcc dot gnu dot org  2005-01-10 11:02 -------
Proposed patch here:
  http://gcc.gnu.org/ml/java-patches/2005-q1/msg00050.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19277


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug java/19277] allows array.length++ although it is final
  2005-01-05 19:50 [Bug java/19277] New: allows array.length++ although it is final kon at iki dot fi
  2005-01-05 20:39 ` [Bug java/19277] " pinskia at gcc dot gnu dot org
  2005-01-10 11:02 ` rmathew at gcc dot gnu dot org
@ 2005-01-10 18:01 ` cvs-commit at gcc dot gnu dot org
  2005-01-10 18:07 ` cvs-commit at gcc dot gnu dot org
  2005-01-10 19:10 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-10 18:01 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-10 18:01 -------
Subject: Bug 19277

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rmathew@gcc.gnu.org	2005-01-10 18:01:05

Modified files:
	gcc/java       : ChangeLog check-init.c 

Log message:
	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.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1526&r2=1.1527
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/check-init.c.diff?cvsroot=gcc&r1=1.62&r2=1.63



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19277


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug java/19277] allows array.length++ although it is final
  2005-01-05 19:50 [Bug java/19277] New: allows array.length++ although it is final kon at iki dot fi
                   ` (2 preceding siblings ...)
  2005-01-10 18:01 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-10 18:07 ` cvs-commit at gcc dot gnu dot org
  2005-01-10 19:10 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-10 18:07 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-10 18:07 -------
Subject: Bug 19277

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rmathew@gcc.gnu.org	2005-01-10 18:07:22

Modified files:
	libjava        : ChangeLog 
Added files:
	libjava/testsuite/libjava.compile: PR19277.java PR19277.xfail 

Log message:
	* testsuite/libjava.compile/PR19277.java: New file for PR java/19277.
	* testsuite/libjava.compile/PR19277.xfail: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3276&r2=1.3277
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR19277.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR19277.xfail.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19277


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug java/19277] allows array.length++ although it is final
  2005-01-05 19:50 [Bug java/19277] New: allows array.length++ although it is final kon at iki dot fi
                   ` (3 preceding siblings ...)
  2005-01-10 18:07 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-10 19:10 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-10 19:10 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-10 19:10 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19277


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-10 19:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-05 19:50 [Bug java/19277] New: allows array.length++ although it is final kon at iki dot fi
2005-01-05 20:39 ` [Bug java/19277] " pinskia at gcc dot gnu dot org
2005-01-10 11:02 ` rmathew at gcc dot gnu dot org
2005-01-10 18:01 ` cvs-commit at gcc dot gnu dot org
2005-01-10 18:07 ` cvs-commit at gcc dot gnu dot org
2005-01-10 19:10 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).