------- Comment #1 from burnus at gcc dot gnu dot org  2008-09-13 14:48 -------
First patch - completely untested/uncompiled:
Index: expr.c
===================================================================
--- expr.c      (Revision 140340)
+++ expr.c
@@ -3053 +3053,2 @@ gfc_check_pointer_assign (gfc_expr *lval
-  if (attr.is_protected && attr.use_assoc)
+  if (attr.is_protected && attr.use_assoc
+      && !(attr.pointer || attr.proc_pointer))


I don't quite understand why one gets "Error: PROTECTED at (1) only allowed in
specification part of a module" for the following example.

module m
  implicit none
  integer, pointer, protected :: protected_pointer
  integer, target, protected :: protected_target
end module m

program p
  use m
  implicit none
  integer, pointer :: unprotected_pointer
  unprotected_pointer => protected_target  ! OK, is rejected
  unprotected_pointer => protected_pointer ! WRONG, is wrongly REJECTED
  protected_pointer => unprotected_pointer ! OK, is rejected, BUT MATCH ERROR
end program p


-- 


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

Reply via email to