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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-09-15
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from janus at gcc dot gnu.org 2011-09-15 19:32:59 UTC ---
(In reply to comment #2)
> C728 (R742) The proc-target shall not be a nonintrinsic elemental procedure.

Here is a simple patch for this constraint:


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c    (revision 178888)
+++ gcc/fortran/expr.c    (working copy)
@@ -3448,6 +3448,14 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex
                   rvalue->symtree->name, &rvalue->where) == FAILURE)
         return FAILURE;
     }
+      /* Check for F08:C730.  */
+      if (attr.elemental && !attr.intrinsic)
+    {
+      gfc_error ("Nonintrinsic elemental procedure '%s' is invalid "
+             "in procedure pointer assigment at %L",
+             rvalue->symtree->name, &rvalue->where);
+      return FAILURE;
+    }

       /* Ensure that the calling convention is the same. As other attributes
      such as DLLEXPORT may differ, one explicitly only tests for the


and a minimal test case:


  implicit none
  procedure(my_dcos), pointer :: f
  f => my_dcos
contains
  real elemental function my_dcos(x)
    real, intent(in) :: x
    my_dcos = cos(x)
  end function
end

Reply via email to