java/5941: incorrect "Unreachable statement" error

Tom Tromey tromey@redhat.com
Mon Apr 1 16:56:00 GMT 2002


The following reply was made to PR java/5941; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: Eric Blake <ebb9@email.byu.edu>
Cc: shroff@transeda.com, gcc-gnats@gcc.gnu.org, Per Bothner <per@bothner.com>
Subject: Re: java/5941: incorrect "Unreachable statement" error
Date: 01 Apr 2002 17:57:19 -0700

 >>>>> "Eric" == Eric Blake <ebb9@email.byu.edu> writes:
 
 Eric> for (int i = 0; ; i++) break;
 Eric> is legal, even though i++ will never be executed, because i++ is
 Eric> not a complete statement and is therefore not subject to the
 Eric> rules of JLS 14.20.
 
 Thanks for looking into this.  Unfortunately it looks difficult to fix
 the bug due to how loops are represented in gcj.
 
 One approach to fixing it would be to introduce a new FOR tree, which
 we could then handle specially in check-init.  Then later we would
 lower this FOR to a LOOP_EXPR.  We'll want to do something like this
 anyway for the AST work.
 
 Tom



More information about the Gcc-prs mailing list