aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index c7332a52..d789efb 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -386,6 +386,10 @@ can_widen_reference_to (source_type, target_type)
int source_depth = class_depth (source_type);
int target_depth = class_depth (target_type);
+ /* class_depth can return a negative depth if an error occurred */
+ if (source_depth < 0 || target_depth < 0)
+ return 0;
+
if (CLASS_INTERFACE (TYPE_NAME (target_type)))
{
/* target_type is OK if source_type or source_type ancestors