This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR fortran/45197: F2008: Allow IMPURE elemental procedures

Tobias Burnus wrote:
Daniel Kraft wrote:
No regressions on GNU/Linux-x86-32. Ok for trunk?

Can you also add a check for

C1289 All dummy arguments of an elemental procedure shall be scalar noncoarray dummy data objects and shall not have the POINTER or ALLOCATABLE attribute.

The ALLOCATABLE part is unchecked (also without your patch):

impure elemental subroutine impEl(a)
  integer, allocatable,intent(in) :: a
end subroutine impel

* * *

If one looks at the following program

integer :: x(10),y(10)
call impEl(x,y(1))
impure elemental subroutine impEl(a,b)
  integer, intent(inout) :: a
  integer :: b
  ! INTENT(OUT) :: b
end subroutine impel

it is unclear what it is supposed to do. If "b" is INTENT(OUT)/INTENT(INOUT) the following error is printed:

call impEl(x,y(1))
Error: Actual argument at (1) for INTENT(OUT) dummy 'b' of ELEMENTAL subroutine 'impel' is a scalar, but another actual argument is an array

I think an error should be printed - either by including INTENT_UNKNOWN in the list of checks or by requiring that the intent is specified.

In the interpretation request F08/0024, cf., an edit to always require INTENTs for ELEMENTAL procedues was proposed. The proposal has passed the J3 meeting, cf. and all 8 results of the J3 balloting were "Y"es, if I counted correctly. Note: At the WG5 meeting, the intepretation could still be changed, but that seems to be unlikely in this case.

Thus, can you add a check that ELEMENTAL procedures always have an INTENT specified?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]