This is the mail archive of the
java-prs@sources.redhat.com
mailing list for the Java project.
gcj/371: += semantics not correct
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/371: += semantics not correct
- From: tromey at redhat dot com
- Date: 19 Nov 2000 22:55:45 -0000
- Reply-To: tromey at redhat dot com
>Number: 371
>Category: gcj
>Synopsis: += semantics not correct
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Nov 19 15:00:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Tom Tromey
>Release: unknown-1.0
>Organization:
>Environment:
>Description:
Consider the program below.
It prints `2'.
However, it should print `1'.
The problem is that we evaluate the left-hand side
of the `+=' twice, contradicting JLS 15.26.2.
Maybe using a SAVE_EXPR in build_assignment()
would be good enough?
public class fp
{
public static void main (String[] args)
{
int i = 0;
int[] foo = {2, 3, 4};
foo[i++] += 7;
System.out.println (i);
}
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: