aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-09-18 21:52:21 +0000
committerTom Tromey <tromey@redhat.com>2006-09-18 21:52:21 +0000
commit5b86cfa67513fa33df912491965752effe70bf59 (patch)
tree6e9a5e44ef9e401e58c72dc8bfbee402d755a6af
parent9dc990c24c8caf2be9378afc012534159dc090be (diff)
svn merge -r116888:116905 svn+ssh://gcc.gnu.org/svn/gcc/trunk/gcc/java
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch@117036 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog27
-rw-r--r--gcc/java/expr.c33
-rw-r--r--gcc/java/jcf-write.c10
-rw-r--r--gcc/java/jvspec.c3
4 files changed, 52 insertions, 21 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index bed9ce3366d..b30228a848e 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,30 @@
+2006-09-12 Tom Tromey <tromey@redhat.com>
+
+ * expr.c (push_value): Always flush quick stack.
+
+2006-09-12 Tom Tromey <tromey@redhat.com>
+
+ PR java/29013:
+ * jcf-write.c (generate_bytecode_insns) <CALL_EXPR>: Always note
+ the push of the called method's return result.
+
+2006-09-12 Tom Tromey <tromey@redhat.com>
+
+ * jvspec.c (lang_specific_driver): Read spec file even if
+ -fsyntax-only.
+
+2006-09-12 Tom Tromey <tromey@redhat.com>
+
+ PR java/28754:
+ * expr.c (expand_java_field_op): Initialize field's declaring
+ interface if necessary.
+
+2006-09-12 Tom Tromey <tromey@redhat.com>
+
+ PR java/28892:
+ * expr.c (expand_java_field_op): No error for assignments not in
+ class initializer or constructor.
+
2006-08-22 Andrew Haley <aph@redhat.com>
* decl.c (java_add_stmt): Give the statement list a type.
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index a64bda8ff02..3cb3db7bb2c 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -301,6 +301,13 @@ push_value (tree value)
TREE_CHAIN (node) = quick_stack;
quick_stack = node;
}
+ /* If the value has a side effect, then we need to evaluate it
+ whether or not the result is used. If the value ends up on the
+ quick stack and is then popped, this won't happen -- so we flush
+ the quick stack. It is safest to simply always flush, though,
+ since TREE_SIDE_EFFECTS doesn't capture COMPONENT_REF, and for
+ the latter we may need to strip conversions. */
+ flush_quick_stack ();
}
/* Pop a type from the type stack.
@@ -2837,7 +2844,12 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
field_ref = build_field_ref (field_ref, self_type, field_name);
if (is_static
&& ! flag_indirect_dispatch)
- field_ref = build_class_init (self_type, field_ref);
+ {
+ tree context = DECL_CONTEXT (field_ref);
+ if (context != self_type && CLASS_INTERFACE (TYPE_NAME (context)))
+ field_ref = build_class_init (context, field_ref);
+ field_ref = build_class_init (self_type, field_ref);
+ }
if (is_putting)
{
flush_quick_stack ();
@@ -2846,21 +2858,10 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
if (DECL_CONTEXT (field_decl) != current_class)
error ("assignment to final field %q+D not in field's class",
field_decl);
- else if (FIELD_STATIC (field_decl))
- {
- if (!DECL_CLINIT_P (current_function_decl))
- warning (0, "assignment to final static field %q+D not in "
- "class initializer",
- field_decl);
- }
- else
- {
- tree cfndecl_name = DECL_NAME (current_function_decl);
- if (! DECL_CONSTRUCTOR_P (current_function_decl)
- && !ID_FINIT_P (cfndecl_name))
- warning (0, "assignment to final field %q+D not in constructor",
- field_decl);
- }
+ /* We used to check for assignments to final fields not
+ occurring in the class initializer or in a constructor
+ here. However, this constraint doesn't seem to be
+ enforced by the JVM. */
}
if (TREE_THIS_VOLATILE (field_decl))
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index aa4d33b141f..b68ec250229 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -2651,10 +2651,14 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
if (TREE_CODE (f) != VOID_TYPE)
{
int size = TYPE_IS_WIDE (f) ? 2 : 1;
+ /* Always note the push here, so that we correctly
+ compute the required maximum stack size. */
+ NOTE_PUSH (size);
if (target == IGNORE_TARGET)
- emit_pop (size, state);
- else
- NOTE_PUSH (size);
+ {
+ emit_pop (size, state);
+ NOTE_POP (size);
+ }
}
break;
}
diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c
index 73c761fde0f..6a09a50b3b4 100644
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
@@ -1,6 +1,6 @@
/* Specific flags and argument handling of the front-end of the
GNU compiler for the Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GCC.
@@ -358,7 +358,6 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
else if (strcmp (argv[i], "-fsyntax-only") == 0
|| strcmp (argv[i], "--syntax-only") == 0)
{
- want_spec_file = 0;
library = 0;
will_link = 0;
continue;