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

           Summary: Statement functions and POINTER attribute
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Kind of follow up to PR 47042.

I think the following is invalid, though I cannot fully pin-point it in the
standard:


integer, target :: c = 55
integer, pointer :: a, b

a() = c   ! << Statement function with pointer attribute
allocate(b)
b = a()   ! (1)
b => a()  ! (2)
end


The program is accepted by gfortran but rejected by other compilers:

Pathscale:
  "A" has the POINTER attribute, therefore it must not be declared as a
statement function (identifier first appeared at line 2)

ifort:
  error #6394: A statement function can not be pointer-valued.   [A]

NAG
  Error: stm.f90, line 4: POINTER A cannot be a statement function


I assume the same is true for allocatable; though, other compilers do not show
this clearly. Ifort has:

  error #6410: This name has not been declared as an array or a function.   [A]
a() = c
^

Reply via email to