public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Saurin B. Shroff" <shroff@transeda.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: java/5941: incorrect "Unreachable statement" error Date: Wed, 13 Mar 2002 12:56:00 -0000 [thread overview] Message-ID: <20020313205603.21264.qmail@sources.redhat.com> (raw) The following reply was made to PR java/5941; it has been noted by GNATS. From: "Saurin B. Shroff" <shroff@transeda.com> To: tromey@redhat.com Cc: gcc-gnats@gcc.gnu.org, Saurin Shroff <shroff@transeda.com> Subject: Re: java/5941: incorrect "Unreachable statement" error Date: Wed, 13 Mar 2002 15:49:07 -0500 Thanks a lot for a quick response... I had similar error in three other files with no apparent similarities. Upon closer look, I found that all four loops had one thing common: they all exited the loop after first iteration. Some of them "returned" after first iteration, some "break"ed from the loop. Following is a simplified code that shows this behavior: public class bug2 { public static int showBug2 () { for (int i=0; i <= 10; i++) { if ( i > 3 ) { return 10; } else { return 11; } } return 12; } } As you will notice that loop is exited after first iteration, and so the loop incrementer "i++" will never be executed. So it seems that we have found some bugs in our code thanks to GCJ. What I would suggest that "Unreachable statement" should be a warning rather than error since it stops the compilation -- Saurin Tom Tromey wrote: > > >>>>> "Saurin" == shroff <shroff@transeda.com> writes: > > Saurin> Synopsis: incorrect "Unreachable statement" error > Saurin> Release: GNU Java version 3.0.1 (sparc-sun-solaris2.8) > > Saurin> hdlFSM.java:448: Unreachable statement. > Saurin> for (int i=lowIndex; i <= highIndex; i++) { > Saurin> ^ > Saurin> 1 error > > Do you have a small (one or two files) test case? > Or can you easily try the gcj from the 3.1 CVS branch? > > As I recall this code has been substantially improved in 3.1. > I imagine your bug has already been fixed. > > Tom
next reply other threads:[~2002-03-13 20:56 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-03-13 12:56 Saurin B. Shroff [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-05-06 21:14 tromey 2002-04-25 11:47 tromey 2002-04-01 19:46 Per Bothner 2002-04-01 16:56 Tom Tromey 2002-04-01 16:46 Eric Blake 2002-03-25 14:46 Eric Blake 2002-03-25 13:26 Tom Tromey 2002-03-13 12:16 Tom Tromey 2002-03-13 11:36 shroff
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020313205603.21264.qmail@sources.redhat.com \ --to=shroff@transeda.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).