Patch: -Wunreachable-bytecode

Tom Tromey tromey@redhat.com
Sun Jun 16 13:30:00 GMT 2002


>>>>> "Per" == Per Bothner <per@bothner.com> writes:

Per> Why do we want to supress it?  Is it unreachable bytecode in
Per> .class files generated by gcj?

Yes.  The appended file causes gcj to emit an unused instruction.

Tom

public class zt
{
  public boolean arrayEquals(Object[] o1, Object[] o2)
  {
    // We assume ordering is important.
    for (int i = 0; i < o1.length; i++)
      if (o1[i] instanceof Object[])
	{
	  if (o2[i] instanceof Object[]) 
	    {
	      if (!arrayEquals((Object[])o1[i], (Object[])o2[i]))
		return(false);
	    }
	  else
	    return(false);
	}
      else
	if (!o1[i].equals(o2[i]))
	  return(false);

    return(true);
  }
}



More information about the Java-patches mailing list