aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index eb92527..96a2cd7 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -5883,8 +5883,16 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict, bool permit_element)
if (expr->expr_type == EXPR_FUNCTION)
{
- if (expr->value.function.esym)
- return expr->value.function.esym->result->attr.contiguous;
+ if (expr->value.function.isym)
+ /* TRANSPOSE is the only intrinsic that may return a
+ non-contiguous array. It's treated as a special case in
+ gfc_conv_expr_descriptor too. */
+ return (expr->value.function.isym->id != GFC_ISYM_TRANSPOSE);
+ else if (expr->value.function.esym)
+ /* Only a pointer to an array without the contiguous attribute
+ can be non-contiguous as a result value. */
+ return (expr->value.function.esym->result->attr.contiguous
+ || !expr->value.function.esym->result->attr.pointer);
else
{
/* Type-bound procedures. */