This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
gcj/109: Source parser; break causes incorrect exit in some nested for-loops
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/109: Source parser; break causes incorrect exit in some nested for-loops
- From: warg at ce dot chalmers dot se
- Date: 25 Nov 1999 21:02:18 -0000
- Reply-To: warg at ce dot chalmers dot se
- Resent-Cc: java-prs at sourceware dot cygnus dot com, green at cygnus dot com
- Resent-Reply-To: java-gnats@sourceware.cygnus.com, warg@ce.chalmers.se
>Number: 109
>Category: gcj
>Synopsis: Source parser; break causes incorrect exit in some nested for-loops
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 25 13:16:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Fredrik Warg <warg@ce.chalmers.se>
>Release: gcc 2.95 (reported to remain in gcc 991122)
>Organization:
>Environment:
any
>Description:
Running the test code produces the output "0" instead of the expected "01234".
The break statement exits both for-loops (not just the innermost one) if the (single statement) body of the outer for-loop is not enclosed in braces. Affects more deeply nested loops in the same way.
>How-To-Repeat:
Run the following test code:
public class Main {
public static void main(String argv[]) {
int i, j;
for (i=0; i<5; i++)
for (j=0; j<2; j++)
{
if (j==1) break;
System.out.print(i);
}
}
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: