This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: PR 4509


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]