------- Comment #2 from janus at gcc dot gnu dot org  2008-11-16 18:59 -------
(In reply to comment #1)
> By the way, the following also fails:
> 
> module m
> procedure(), pointer :: procptr
> end module m
> 
> use m
> external foo
> procptr => foo
> end
> 
> with Error: 'procptr' in the pointer assignment at (1) cannot be an
> l-value since it is a procedure
> 
> I think the "proc_ptr" attribute is not properly saved in the .mod file.

Actually this is not the problem. All attributes are saved properly.
The error is fixed by the following trivial patch:

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 141915)
+++ gcc/fortran/expr.c  (working copy)
@@ -3034,7 +3034,8 @@ gfc_check_pointer_assign (gfc_expr *lval
     }

   if (lvalue->symtree->n.sym->attr.flavor == FL_PROCEDURE
-      && lvalue->symtree->n.sym->attr.use_assoc)
+      && lvalue->symtree->n.sym->attr.use_assoc
+      && !lvalue->symtree->n.sym->attr.proc_pointer)
     {
       gfc_error ("'%s' in the pointer assignment at %L cannot be an "
                 "l-value since it is a procedure",


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-11-16 18:59:41
               date|                            |


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

Reply via email to