[Patch, Fortran] PR fortran/45197: F2008: Allow IMPURE elemental procedures
Tobias Burnus
burnus@net-b.de
Sat Aug 14 09:01:00 GMT 2010
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))
contains
impure elemental subroutine impEl(a,b)
integer, intent(inout) :: a
integer :: b
! INTENT(OUT) :: b
end subroutine impel
end
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))
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.
http://j3-fortran.org/doc/meeting/192/10-174r1.txt, an edit to always
require INTENTs for ELEMENTAL procedues was proposed. The proposal has
passed the J3 meeting, cf.
http://j3-fortran.org/doc/meeting/193/10-199.txt 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?
Tobias
More information about the Gcc-patches
mailing list