http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57992

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Draft patch:
* Handles POINTER (-> temporary), POINTER, CONTIGUOUS (-> no temporary) and
ALLOCATABLE (->no temporary)

TODO
* Nonpointers, nonallocatables (like f3) are *not* handled (why?)
* Check whether TBP or PPC are handled correctly
* Check whether sym == sym->result and sym != sym->result are handled
* Check whether CLASS is handled correctly

--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7012,6 +7012,11 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr,
bool g77,

   if (expr->expr_type == EXPR_VARIABLE && ref && !ultimate_ptr_comp)
     full_array_var = gfc_full_array_ref_p (ref, &contiguous);
+  else if (expr->expr_type == EXPR_FUNCTION)
+    {
+      symbol_attribute attr = gfc_expr_attr (expr);
+      contiguous = !attr.pointer || attr.contiguous;
+    }

   sym = full_array_var ? expr->symtree->n.sym : NULL;

Reply via email to