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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23656
138bc75d-0d04-0410-961f-
82ee72b054a4
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;
}
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;