[patch] Java definite assignment

Mo DeJong mdejong@cygnus.com
Tue Feb 6 10:26:00 GMT 2001


On 6 Feb 2001, Tom Tromey wrote:
> >>>>> "Per" == Per Bothner <per@bothner.com> writes:
>> Per> This does seem like the correct fix, but I haven't tested it
> Per> seriously. Could someone try applying it before their next build
> Per> and testsuite-run?
>> Per> * check-init.c (check_init): Don't call done_alternative after
> Per> processing loop code, as a LOOP_EXPR never terminates normally.
>> Changes like this are good candidates for before-and-after runs
> through Jacks, to see if they cause regressions and/or improvements.
> IMHO.
>> Tom

I applied this patch and ran Jacks over it again. I did not
see any regressions, but I also did not see any FAILED -> PASSED
conversions. It looks like there are no tests for the
specific bug that this patch should be fixing, so I created
the following test cases:
tcltest::test true-1 { for loop + if + break } {
 empty_main T1 {
 int i;
 for (;;) {
 if (true) {
 i = 0;
 break;
 }
 }
 i++;
 }
} PASS
tcltest::test true-2 { for while + if + break } {
 empty_main T2 {
 int i;
 while (true) {
 if (true) {
 i = 0;
 break;
 }
 }
 i++;
 }
} PASS
tcltest::test false-1 { for loop + if + break } {
 empty_main F1 {
 int i;
 for (;;) {
 if (false) {
 i = 0;
 break;
 }
 }
 i++;
 }
} FAIL
tcltest::test none-1 { for while + break } {
 empty_main N1 {
 int i;
 while (true) {
 i = 0;
 break;
 }
 i++;
 }
} PASS
tcltest::test non-const-1 { for + if with nonconst variable,
 this should fail since we can't know at compile time
 that b is true } {
 empty_main NC1 {
 int i;
 boolean b = true;
 for (;;) {
 if (b) {
 i = 0;
 break;
 }
 }
 i++;
 }
} FAIL
tcltest::test non-const-2 { for + if with nonconst variable,
 this should fail since we can't know at compile time
 that b is true } {
 empty_main NC2 {
 int i;
 boolean b = false;
 for (;;) {
 if (b) {
 i = 0;
 break;
 }
 }
 i++;
 }
} FAIL
These tests all pass before the patch is added:
gcj: Total 6 Passed 6 Skipped 0 Failed 0
After adding the patch, 3 of these tests fail:
gcj: Total 6 Passed 3 Skipped 0 Failed 3
The ones that failed are:
==== false-1 for loop + if + break FAILED
==== Contents of test case:
 empty_main F1 {
 int i;
 for (;;) {
 if (false) {
 i = 0;
 break;
 }
 }
 i++;
 }
---- Result was:
PASS
---- Result should have been:
FAIL
==== false-1 FAILED
==== non-const-1 for + if with nonconst variable,
 this should fail since we can't know at compile time
 that b is true FAILED
==== Contents of test case:
 empty_main NC1 {
 int i;
 boolean b = true;
 for (;;) {
 if (b) {
 i = 0;
 break;
 }
 }
 i++;
 }
---- Result was:
PASS
---- Result should have been:
FAIL
==== non-const-1 FAILED
==== non-const-2 for + if with nonconst variable,
 this should fail since we can't know at compile time
 that b is true FAILED
==== Contents of test case:
 empty_main NC2 {
 int i;
 boolean b = false;
 for (;;) {
 if (b) {
 i = 0;
 break;
 }
 }
 i++;
 }
---- Result was:
PASS
---- Result should have been:
FAIL
==== non-const-2 FAILED
At this point, I would advise against adding
that patch.
Mo DeJong
Red Hat Inc


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /