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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-04 
19:39:32 UTC ---
(In reply to comment #3)
> Sorry, I don't understand why you consider the bug report invalid.
> You may very well be correct, but please explain. I am not such a
> Fortran expert, so I may have missed something here.


I thought the error message (with -std=f2003) in comment 1 was rather clear,
seemingly that's not the case:


    call testsub(a%i)
                 1
Error: Fortran 2008: Non-pointer actual argument at (1) to pointer dummy 'p'


That means: It is allowed in Fortran 2008, but not before. (See below for the
details.)


  * * *


If one looks into the Fortran 2008 standard
(http://gcc.gnu.org/wiki/GFortranStandards), one finds the following:


"12.5.2.7 Pointer dummy variables"


"If the dummy argument does not have the INTENT (IN), the actual argument shall
be a pointer. Otherwise, the actual argument shall be a pointer or a valid
target for the dummy pointer in a pointer assignment statement. If the actual
argument is not a pointer, the dummy pointer becomes pointer associated with
the actual argument."


Thus, the crucial points are:

(a) the dummy argument has INTENT(IN) - which "p" has
(b) the actual argument has the TARGET attribute which "a" and thus "a%i" has


The INTENT(IN) for the pointer ensures that the pointer association is not
modified -- and TARGET avoids alias issues. Thus, there is no technical reason
for not allowing it -- which the standardization committee seemingly also
realized. Thus, it is now allowed in Fortran 2008.

 * * *

For an overview about the new Fortran 2008 features, see also
  ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1828.pdf

For the already implemented F2008 features, see
  http://gcc.gnu.org/wiki/Fortran2008Status
or in the release notes:
  http://gcc.gnu.org/wiki/GFortran#news
  http://gcc.gnu.org/gcc-4.6/changes.html

Reply via email to