aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/lang.c
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2003-11-12 15:24:42 +0000
committerAndrew Haley <aph@gcc.gnu.org>2003-11-12 15:24:42 +0000
commit7304c6cfe91d479beeb49167441faa26226cf8cf (patch)
treef18ec01257339870bfe0454f85747078700d4dc4 /gcc/java/lang.c
parent88f08cca2804fb07fda114bf414ce0e4c18be6d3 (diff)
downloadgcc-7304c6cfe91d479beeb49167441faa26226cf8cf.zip
gcc-7304c6cfe91d479beeb49167441faa26226cf8cf.tar.gz
gcc-7304c6cfe91d479beeb49167441faa26226cf8cf.tar.bz2
re PR java/11533 (Inlining drops static initialization of inner class)
2003-11-12 Andrew Haley <aph@redhat.com> PR java/11533 * lang.c (merge_init_test_initialization): Clear DECL_INITIAL for init_test_decls being inlined. PR java/12890: * parse.y (do_resolve_class): Check return value from breakdown_qualified(). From-SVN: r73494
Diffstat (limited to 'gcc/java/lang.c')
-rw-r--r--gcc/java/lang.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 615d250..a649a4a 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -926,6 +926,24 @@ merge_init_test_initialization (void **entry, void *x)
if (!*init_test_decl)
*init_test_decl = (tree)n->value;
+ /* This fixes a weird case.
+
+ The front end assumes that once we have called a method that
+ initializes some class, we can assume the class is initialized. It
+ does this by setting the DECL_INITIAL of the init_test_decl for that
+ class, and no initializations are emitted for that class.
+
+ However, what if the method that is suppoed to do the initialization
+ is itself inlined in the caller? When expanding the called method
+ we'll assume that the class initalization has already been done,
+ because the DECL_INITIAL of the init_test_decl is set.
+
+ To fix this we remove the DECL_INITIAL (in the caller scope) of all
+ the init_test_decls corresponding to classes initialized by the
+ inlined method. This makes the caller no longer assume that the
+ method being inlined does any class initializations. */
+ DECL_INITIAL (*init_test_decl) = NULL;
+
return true;
}