diff options
author | Tom Tromey <tromey@redhat.com> | 2003-03-11 20:37:02 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2003-03-11 20:37:02 +0000 |
commit | 8b8e6c64afcc492a3b124a229e9b7774e032fdb9 (patch) | |
tree | fa514899cdd4ebb3ba4558eb16c3f0be370427be /gcc/java/expr.c | |
parent | 218d1401afae50f7ec94e61f75d0ce397c22e944 (diff) | |
download | gcc-8b8e6c64afcc492a3b124a229e9b7774e032fdb9.zip gcc-8b8e6c64afcc492a3b124a229e9b7774e032fdb9.tar.gz gcc-8b8e6c64afcc492a3b124a229e9b7774e032fdb9.tar.bz2 |
parse.y (resolve_field_access): Initialize class if field is found in another static field.
* parse.y (resolve_field_access): Initialize class if field is
found in another static field.
* expr.c (build_class_init): Don't optimize out initialization of
implemented interface.
From-SVN: r64185
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 48e67df..1174823 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1672,7 +1672,14 @@ tree build_class_init (tree clas, tree expr) { tree init; - if (inherits_from_p (current_class, clas)) + + /* An optimization: if CLAS is a superclass of the class we're + compiling, we don't need to initialize it. However, if CLAS is + an interface, it won't necessarily be initialized, even if we + implement it. */ + if ((! CLASS_INTERFACE (TYPE_NAME (clas)) + && inherits_from_p (current_class, clas)) + || current_class == clas) return expr; if (always_initialize_class_p) |