1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
2! C815 An entity shall not be explicitly given any attribute more than once in
3! a scoping unit.
4!
5! R1512 procedure-declaration-stmt ->
6!         PROCEDURE ( [proc-interface] ) [[, proc-attr-spec]... ::]
7!         proc-decl-list
8!  proc-attr-spec values are:
9!    PUBLIC, PRIVATE, BIND(C), INTENT (intent-spec), OPTIONAL, POINTER,
10!    PROTECTED, SAVE
11module m
12  abstract interface
13    real function procFunc()
14    end function procFunc
15  end interface
16
17  !WARNING: Attribute 'PUBLIC' cannot be used more than once
18  procedure(procFunc), public, pointer, public :: proc1
19  !WARNING: Attribute 'PRIVATE' cannot be used more than once
20  procedure(procFunc), private, pointer, private :: proc2
21  !WARNING: Attribute 'BIND(C)' cannot be used more than once
22  procedure(procFunc), bind(c), pointer, bind(c) :: proc3
23  !WARNING: Attribute 'PROTECTED' cannot be used more than once
24  procedure(procFunc), protected, pointer, protected :: proc4
25
26contains
27
28    subroutine testProcDecl(arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)
29      !WARNING: Attribute 'INTENT(IN)' cannot be used more than once
30      procedure(procFunc), intent(in), pointer, intent(in) :: arg4
31      !WARNING: Attribute 'INTENT(OUT)' cannot be used more than once
32      procedure(procFunc), intent(out), pointer, intent(out) :: arg5
33      !WARNING: Attribute 'INTENT(INOUT)' cannot be used more than once
34      procedure(procFunc), intent(inout), pointer, intent(inout) :: arg6
35      !ERROR: Attributes 'INTENT(INOUT)' and 'INTENT(OUT)' conflict with each other
36      procedure(procFunc), intent(inout), pointer, intent(out) :: arg7
37      !ERROR: Attributes 'INTENT(INOUT)' and 'INTENT(OUT)' conflict with each other
38      procedure(procFunc), intent(out), pointer, intent(inout) :: arg8
39      !WARNING: Attribute 'OPTIONAL' cannot be used more than once
40      procedure(procFunc), optional, pointer, optional :: arg9
41      !WARNING: Attribute 'POINTER' cannot be used more than once
42      procedure(procFunc), pointer, optional, pointer :: arg10
43      !WARNING: Attribute 'SAVE' cannot be used more than once
44      procedure(procFunc), save, pointer, save :: localProc
45    end subroutine testProcDecl
46
47end module m
48