aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r--gcc/fortran/expr.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index a162744..be138d1 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -5573,11 +5573,14 @@ bool
gfc_is_alloc_class_scalar_function (gfc_expr *expr)
{
if (expr->expr_type == EXPR_FUNCTION
- && expr->value.function.esym
- && expr->value.function.esym->result
- && expr->value.function.esym->result->ts.type == BT_CLASS
- && !CLASS_DATA (expr->value.function.esym->result)->attr.dimension
- && CLASS_DATA (expr->value.function.esym->result)->attr.allocatable)
+ && ((expr->value.function.esym
+ && expr->value.function.esym->result
+ && expr->value.function.esym->result->ts.type == BT_CLASS
+ && !CLASS_DATA (expr->value.function.esym->result)->attr.dimension
+ && CLASS_DATA (expr->value.function.esym->result)->attr.allocatable)
+ || (expr->ts.type == BT_CLASS
+ && CLASS_DATA (expr)->attr.allocatable
+ && !CLASS_DATA (expr)->attr.dimension)))
return true;
return false;