This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PATCH: Re: gcj non-optimization curiosity
- From: Tom Tromey <tromey at redhat dot com>
- To: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Cc: java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: 17 Dec 2001 15:21:53 -0700
- Subject: Re: PATCH: Re: gcj non-optimization curiosity
- References: <87vgf628c4.fsf@creche.redhat.com> <3C1D723A.7000803@waitaki.otago.ac.nz>
- Reply-to: tromey at redhat dot com
>>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
Thanks for looking into this.
Bryce> Where .L14 is the "throw ArrayBoundsException". The redundant
Bryce> bounds check is check is still there (it can never occur
Bryce> because the bounds of the loop are the same as the bounds of
Bryce> the array, so why can't the optimizer get rid of it?), but the
Bryce> generated code is much better than before.
The more-or-less equivalent C++ code, appended, also generates a
redundant bounds check. Perhaps our optimizer simply can't do this
yet.
Tom
struct z
{
const int length;
int ary[0];
};
extern struct z *foo ();
int main ()
{
struct z *l = foo ();
int i;
int x = 0;
for (i = 0; i < l->length; ++i)
{
if ((unsigned) i >= (unsigned) (l->length))
throw 1;
x += l->ary[i];
}
return x;
}