http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50684
--- Comment #1 from janus at gcc dot gnu.org 2011-10-12 19:52:57 UTC ---
Some carryover form PR50570, where I proposed a draft patch:
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 179722)
+++ gcc/fortran/check.c (working copy)
@@ -458,7 +458,8 @@ variable_check (gfc_expr *e, int n, bool allow_pro
if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.intent == INTENT_IN
&& (gfc_current_intrinsic_arg[n]->intent == INTENT_OUT
- || gfc_current_intrinsic_arg[n]->intent == INTENT_INOUT))
+ || gfc_current_intrinsic_arg[n]->intent == INTENT_INOUT)
+ && !(e->symtree->n.sym->attr.pointer && e->ref))
{
gfc_error ("'%s' argument of '%s' intrinsic at %L cannot be INTENT(IN)",
gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
Tobias commented on this as follows ...
That won't work for:
type(t), intent(in) :: dt
call move_alloc(dt%allocatable, ...)
That's invalid as dt%allocatable is intent(in); it would be valid for, e.g.,
call move_alloc(dt%dt2%ptr%allocatable, ...)
One really needs to walk the expression.