unprotected_pointer => protected_pointer
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
unprotected_pointer => protected_pointer         


Author: Steven Correll
Date: Sep 12, 2008 10:25

Looking at N1601.pdf, I see

R735 pointer-assignment-stmt is data-pointer-object [ (bounds-spec-
list) ] => data-target
or data-pointer-object (bounds-remapping-list ) => data-target
or proc-pointer-object => proc-target

And I see constraint C538:

"A pointer object that has the PROTECTED attribute and is accessed by
use association shall
not appear as (1) A pointer-object in a pointer-assignment-stmt..."

C538 doesn't forbid using a protected pointer as the target of a
pointer-assignment-stmt. But two (gfortran 4.4.0, Sun f90 8.3) out of
three compilers surveyed (ifort 10.1 is the third) disallow it. Am I
overlooking something? Thanks in advance.

%% cat p1.f90
module m
implicit none
integer, pointer, protected :: protected_pointer
end module m
Show full article (1.36Kb)
1 Comment
Re: unprotected_pointer => protected_pointer         


Author: nospam
Date: Sep 12, 2008 12:38

Steven Correll <steven.correll@gmail.com> wrote:
> "A pointer object that has the PROTECTED attribute and is accessed by
> use association shall
> not appear as (1) A pointer-object in a pointer-assignment-stmt..."
>
> C538 doesn't forbid using a protected pointer as the target of a
> pointer-assignment-stmt. But two (gfortran 4.4.0, Sun f90 8.3) out of
> three compilers surveyed (ifort 10.1 is the third) disallow it. Am I
> overlooking something?

I don't think you are overlooking anything. Seems to me like those two
compilers are though. C537 prohibits a protected nonpointer object from
being a target. Looks to me like those compilers overlooked the
"nonpointer" part.

The distinction makes sense (to me). If you set a pointer to point to a
nonpointer protected target, you would have just opened a potential way
for that protected object to be changed, possibly in contexts that are
impractical for the compiler to diagnose, thus subverting much of the
point of the protected attribute.
Show full article (1.64Kb)
no comments