This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: PR 4509
- From: Tom Tromey <tromey at redhat dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 20 Dec 2001 22:34:45 -0700
- Subject: Re: Patch: PR 4509
- References: <873d25oi5y.fsf@creche.redhat.com> <3C225183.7080704@bothner.com>
- Reply-to: tromey at redhat dot com
>>>>> "Per" == Per Bothner <per@bothner.com> writes:
Per> You might add a comment that "this can only legally be
Per> unreachable in the case of a do-while" or words to that effect.
Ok, I'll do that.
Tom> I'm not completely sure the new code is correct, since I don't
Tom> understand why the old code was written the way it was.
Per> I believe the reason was to avoid cascading error messages. I.e. for:
Per> break;
Per> stmt1;
Per> stmt2;
Thanks for the info. I tried this program with my patch applied, and
I only get a single message:
public class q
{
public static void main (String[] args)
{
do
{
break;
System.out.println ("x");
System.out.println ("y");
}
while (true);
}
}
creche. gcj -C q.java
q.java: In class `q':
q.java: In method `q.main(java.lang.String[])':
q.java:8: Unreachable statement.
System.out.println ("x");
^
1 error
Per> So your change here is only ok if you make sure this doesn't
Per> happen.
Ok, thanks.
Tom