1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! C801 The same attr-spec shall not appear more than once in a given
4 ! type-declaration-stmt.
6 ! R801 type-declaration-stmt ->
7 ! declaration-type-spec [[, attr-spec]... ::] entity-decl-list
8 ! attr-spec values are:
9 ! PUBLIC, PRIVATE, ALLOCATABLE, ASYNCHRONOUS, CODIMENSION, CONTIGUOUS,
10 ! DIMENSION (array-spec), EXTERNAL, INTENT (intent-spec), INTRINSIC,
11 ! BIND(C), OPTIONAL, PARAMETER, POINTER, PROTECTED, SAVE, TARGET, VALUE,
15 !WARNING: Attribute 'PUBLIC' cannot be used more than once
16 real, public
, allocatable
, public
:: publicVar
17 !WARNING: Attribute 'PRIVATE' cannot be used more than once
18 real, private
, allocatable
, private
:: privateVar
19 !WARNING: Attribute 'ALLOCATABLE' cannot be used more than once
20 real, allocatable
, allocatable
:: allocVar
21 !WARNING: Attribute 'ASYNCHRONOUS' cannot be used more than once
22 real, asynchronous
, public
, asynchronous
:: asynchVar
23 !ERROR: Attribute 'CODIMENSION' cannot be used more than once
24 real, codimension
[*], codimension
[*] :: codimensionVar
25 !WARNING: Attribute 'CONTIGUOUS' cannot be used more than once
26 real, contiguous
, pointer, contiguous
:: contigVar(:)
27 !ERROR: Attribute 'DIMENSION' cannot be used more than once
28 real, dimension(5), dimension(5) :: arrayVar
29 !WARNING: Attribute 'EXTERNAL' cannot be used more than once
30 real, external, external :: externFunc
31 !WARNING: Attribute 'INTRINSIC' cannot be used more than once
32 real, intrinsic, bind(c
), intrinsic :: cos
33 !WARNING: Attribute 'BIND(C)' cannot be used more than once
34 integer, bind(c
), volatile, bind(c
) :: bindVar
35 !WARNING: Attribute 'PARAMETER' cannot be used more than once
36 real, parameter, parameter :: realConst
= 4.3
37 !WARNING: Attribute 'POINTER' cannot be used more than once
38 real, pointer, pointer :: realPtr
39 !WARNING: Attribute 'PROTECTED' cannot be used more than once
40 real, protected
, protected
:: realProt
41 !WARNING: Attribute 'SAVE' cannot be used more than once
42 real, save, save :: saveVar
43 !WARNING: Attribute 'TARGET' cannot be used more than once
44 real, target
, target
:: targetVar
45 !WARNING: Attribute 'VOLATILE' cannot be used more than once
46 real, volatile, volatile :: volatileVar
49 subroutine testTypeDecl(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
)
50 !WARNING: Attribute 'INTENT(IN)' cannot be used more than once
51 real, intent(in
), intent(in
) :: arg1
52 !WARNING: Attribute 'INTENT(OUT)' cannot be used more than once
53 real, intent(out
), intent(out
) :: arg2
54 !WARNING: Attribute 'INTENT(INOUT)' cannot be used more than once
55 real, intent(inout
), intent(inout
) :: arg3
56 !WARNING: Attribute 'OPTIONAL' cannot be used more than once
57 integer, optional
, intent(in
), optional
:: arg4
58 !WARNING: Attribute 'VALUE' cannot be used more than once
59 integer, value
, intent(in
), value
:: arg5
60 !ERROR: Attributes 'INTENT(IN)' and 'INTENT(INOUT)' conflict with each other
61 integer, intent(in
), pointer, intent(inout
) :: arg6
64 end subroutine testTypeDecl