Java: Fix cyclic inheritance detection problem

Bryce McKinlay bryce@waitaki.otago.ac.nz
Fri Apr 27 04:51:00 GMT 2001


Here's something I picked up running jacks on the current GCJ. Code
like the following is causing GCJ to loop forever:

class X extends X {};

Although GCJ has a mechanism to detect cyclic inheritance, it isn't
working in most cases. Possibly this was broken with the multifile
compilation changes, or maybe it was broken even before that. In any
case, the issue is that do_resolve_class, which is called from
java_complete_class, looks at super classes during inner class
resolution to determine if an unqualified class being resolved is a
member of an enclosing supercontext. However, java_complete_class is
called before the existing cyclic inheritance check,
java_check_circular_reference. But java_check_circular_reference can't
be called until the class is fully resolved: catch 22.

Actually, its not clear to me why resolve_class() is called with an
"enclosing" argument at all here, because X is not an inner class, but
I can imagine there are situations where this patch would be required
even if that wasnt the case.

jacks results for the current 3.0 compiler:

gcj:    Total   1735    Passed  1380    Skipped 16      Failed  339

FWIW, this is a list of jacks test result changes since 2001-02-17
(with new tests ommitted):

14.20-try-7 {FAILED PASSED}
14.20-try-9 {PASSED FAILED}
14.20-try-10 {PASSED FAILED}
14.20-try-12 {FAILED PASSED}
14.20-try-25 {FAILED PASSED}
14.20-try-27 {PASSED FAILED}
14.20-try-28 {PASSED FAILED}
8.1.3-circular-2 {PASSED FAILED}
8.8.7-inaccessible-default-constructor-toplevel-2 {PASSED FAILED}
16.2.8-unassigned-6 {PASSED FAILED}
15.9.1-unqualified-anonymous-5 {FAILED PASSED}
15.9.1-unqualified-anonymous-8 {FAILED PASSED}
15.9.1-unqualified-anonymous-15 {FAILED PASSED}
15.9.1-unqualified-anonymous-18 {FAILED PASSED}
15.28-simple-name-9 {FAILED PASSED}
15.28-string-17 {PASSED FAILED}
3.10.2-round-6 {PASSED FAILED}
6.6.1-8 {PASSED FAILED}
6.6.1-11 {PASSED FAILED}

The 8.1.3 regression is unrelated to this patch.

ok to commit?

regards

  [ bryce ]



More information about the Gcc-patches mailing list