From 46cf461c83489859531d548d57e1751f8c5cb68c Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Sat, 14 Nov 1998 09:22:22 -0800 Subject: Allow uses of interface types to verify. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit � Allow uses of interface types to verify. This is not really type-safe, but it matches what Sun does, and is OK as long as there are appropriate run-time checks. * verify.c (merge_types): If merging two interface types, just set the result to java.lang.Object. * expr.c (pop_type): Any interface is matches by java.lang.Object. From-SVN: r23656 --- gcc/java/expr.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/java/expr.c') 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; -- cgit v1.1