https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85797

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
The following patch generates errors for the testcases when one
of the TRANSFER arguments is a procedure (but not a pointer):

Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 269717)
+++ gcc/fortran/check.c (working copy)
@@ -5551,6 +5551,24 @@
       return false;
     }

+  if (source->ts.type == BT_PROCEDURE
+      && !source->symtree->n.sym->attr.pointer)
+    {
+      gfc_error ("%<SOURCE%> argument of %<TRANSFER%> intrinsic at %L "
+                 "must not be a %s", &source->where,
+                gfc_basic_typename (source->ts.type));
+      return false;
+    }
+
+  if (mold->ts.type == BT_PROCEDURE
+      && !mold->symtree->n.sym->attr.pointer)
+    {
+      gfc_error ("%<MOLD%> argument of %<TRANSFER%> intrinsic at %L "
+                 "must not be a %s", &mold->where,
+                gfc_basic_typename (mold->ts.type));
+      return false;
+    }
+
   if (size != NULL)
     {
       if (!type_check (size, 2, BT_INTEGER))

Needs regtesting.

Reply via email to