[flang] Treat pre-processed input as fixed (#117563)
[llvm-project.git] / flang / test / Semantics / resolve82.f90
blob989ce1d837c705e88ecb4e559f6ac79b421639be
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C815 An entity shall not be explicitly given any attribute more than once in
3 ! a scoping unit.
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
11 module m
12 abstract interface
13 real function procFunc()
14 end function procFunc
15 end interface
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 !ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
23 procedure(procFunc), bind(c), pointer, bind(c) :: proc3
24 !WARNING: Attribute 'PROTECTED' cannot be used more than once
25 procedure(procFunc), protected, pointer, protected :: proc4
26 !ERROR: A PROTECTED entity must be a variable or pointer
27 external extsub
28 protected extsub
29 real x
30 !ERROR: A PROTECTED entity must be a variable or pointer
31 namelist /nml/ x
32 protected nml
33 !ERROR: A PROTECTED entity may not be in a common block
34 real y
35 common /blk/ y
36 protected y
37 logical,protected,external,pointer :: z
39 contains
41 subroutine testProcDecl(arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)
42 !WARNING: Attribute 'INTENT(IN)' cannot be used more than once
43 procedure(procFunc), intent(in), pointer, intent(in) :: arg4
44 !WARNING: Attribute 'INTENT(OUT)' cannot be used more than once
45 procedure(procFunc), intent(out), pointer, intent(out) :: arg5
46 !WARNING: Attribute 'INTENT(INOUT)' cannot be used more than once
47 procedure(procFunc), intent(inout), pointer, intent(inout) :: arg6
48 !ERROR: Attributes 'INTENT(INOUT)' and 'INTENT(OUT)' conflict with each other
49 procedure(procFunc), intent(inout), pointer, intent(out) :: arg7
50 !ERROR: Attributes 'INTENT(INOUT)' and 'INTENT(OUT)' conflict with each other
51 procedure(procFunc), intent(out), pointer, intent(inout) :: arg8
52 !WARNING: Attribute 'OPTIONAL' cannot be used more than once
53 procedure(procFunc), optional, pointer, optional :: arg9
54 !WARNING: Attribute 'POINTER' cannot be used more than once
55 procedure(procFunc), pointer, optional, pointer :: arg10
56 !WARNING: Attribute 'SAVE' cannot be used more than once
57 procedure(procFunc), save, pointer, save :: localProc
58 !ERROR: A PROTECTED entity must be in the specification part of a module
59 real x
60 protected x
61 end subroutine testProcDecl
63 end module m
65 subroutine subb()
66 !Ensure no spurious error from a benign UseError
67 use m, testProcDecl=>z
68 end