http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53939
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |burnus at gcc dot gnu.org Resolution| |INVALID --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-12 13:23:53 UTC --- Congratulation, you found another bug in the Compaq compiler. [Sorry for the slight sarcasm. gfortran like any piece of software has bugs and we are happy if users report them. I also won't rule out that the my first analysis is wrong, but your example seems to be a pretty clear cut case.] You change: grid%elem(i)%cl2g(j) = grid%elem(i)%cl2g(j) + 1 where type(grid_type), intent(in) :: grid However, both "elem" and "cl2g" are pointers - thus the "intent(in)" doesn't apply. [Or more precisely, for "cl2g" the intent doesn't apply at all (as it is underneath a pointer component) while for "elem" it only applies to pointer-association changes: Namely, pointer assignment and allocate/deallocate/nullify of "cl2g" is prohibited due to intent(in), changing its value is allowed.] I think in the normative text of the Fortran standard it is a bit hidden, hence I quote the following nonnormative note from the Fortran 2008 standard: "NOTE 5.16 If a dummy argument is a derived-type object with a pointer component, then the pointer as a pointer is a subobject of the dummy argument, but the target of the pointer is not. Therefore, the restrictions on subobjects of the dummy argument apply to the pointer in contexts where it is used as a pointer, but not in contexts where it is dereferenced to indicate its target. For example, if X is a dummy argument of derived type with an integer pointer component P, and X is INTENT (IN), then the statement X%P => NEW_TARGET is prohibited, but X%P = 0 is allowed (provided that X%P is associated with a definable target)."