2019-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
+ PR fortran/89344
+ * expr.c (gfc_check_vardef_context): Check for INTENT(IN) variable
+ in SELECT TYPE construct.
+
+2019-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
PR fortran/88810
* dependency.c (gfc_dep_resolver): Re-arrange code to make the logic
a bit more transparent. Fix 2 nearby formatting issues.
check_intentin = false;
}
}
- if (check_intentin && sym->attr.intent == INTENT_IN)
+
+ if (check_intentin
+ && (sym->attr.intent == INTENT_IN
+ || (sym->attr.select_type_temporary && sym->assoc
+ && sym->assoc->target && sym->assoc->target->symtree
+ && sym->assoc->target->symtree->n.sym->attr.intent == INTENT_IN)))
{
if (pointer && is_pointer)
{
}
if (!pointer && !is_pointer && !sym->attr.pointer)
{
+ const char *name = sym->attr.select_type_temporary
+ ? sym->assoc->target->symtree->name : sym->name;
if (context)
gfc_error ("Dummy argument %qs with INTENT(IN) in variable"
" definition context (%s) at %L",
- sym->name, context, &e->where);
+ name, context, &e->where);
return false;
}
}
+2019-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/89344
+ * gfortran.dg/pr89344.f90: New test.
+
2019-06-13 Iain Sandoe <iain@sandoe.co.uk>
* gcc.dg/darwin-minversion-1.c: Use compile rather than link/run.
--- /dev/null
+! { dg-do compile }
+program demo_setval
+ call setval(value)
+ write(*,*)'VALUE=',value
+ contains
+ subroutine setval(value)
+ class(*),intent(in) :: value
+ select type(value)
+ type is (integer)
+ value = 10 ! { dg-error "in variable definition context" }
+ type is (real)
+ value = 10.20 ! { dg-error "in variable definition context" }
+ end select
+ end subroutine setval
+end program demo_setval