aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/expr.c6
-rw-r--r--gcc/java/verify.c26
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 0df6106..9bd1ca7 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -268,6 +268,12 @@ pop_type (type)
return type;
else if (can_widen_reference_to (t, type))
return t;
+ /* This is a kludge, but matches what Sun's verifier does.
+ It can be tricked, but is safe as long as type errors
+ (i.e. interface method calls) are caught at run-time. */
+ else if (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (type)))
+ && t == object_ptr_type_node)
+ return t;
}
error ("unexpected type on stack");
return t;
diff --git a/gcc/java/verify.c b/gcc/java/verify.c
index d73c52a..9554a81 100644
--- a/gcc/java/verify.c
+++ b/gcc/java/verify.c
@@ -150,6 +150,32 @@ merge_types (type1, type2)
}
return object_ptr_type_node;
}
+
+ if (CLASS_INTERFACE (TYPE_NAME (tt1)))
+ {
+ if (CLASS_INTERFACE (TYPE_NAME (tt2)))
+ {
+ /* This is a kludge, but matches what Sun's verifier does.
+ It can be tricked, but is safe as long as type errors
+ (i.e. interface method calls) are caught at run-time. */
+ return object_ptr_type_node;
+ }
+ else
+ {
+ if (can_widen_reference_to (tt2, tt1))
+ return type1;
+ else
+ return TYPE_UNKNOWN;
+ }
+ }
+ else if (CLASS_INTERFACE (TYPE_NAME (tt2)))
+ {
+ if (can_widen_reference_to (tt1, tt2))
+ return type2;
+ else
+ return TYPE_UNKNOWN;
+ }
+
type1 = tt1;
type2 = tt2;