[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / resolve91.f90
blob9873c5a351a40999505f4558b9850c583122803a
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Tests for duplicate definitions and initializations, mostly of procedures
3 module m
4 procedure(real), pointer :: p
5 !ERROR: EXTERNAL attribute was already specified on 'p'
6 !ERROR: POINTER attribute was already specified on 'p'
7 !ERROR: The interface for procedure 'p' has already been declared
8 procedure(integer), pointer :: p
9 end
11 module m1
12 real, dimension(:), pointer :: realArray => null()
13 !ERROR: POINTER attribute was already specified on 'realarray'
14 !ERROR: The type of 'realarray' has already been declared
15 real, dimension(:), pointer :: realArray => localArray
16 end module m1
18 module m2
19 interface
20 subroutine sub()
21 end subroutine sub
22 end interface
24 procedure(sub), pointer :: p1 => null()
25 !ERROR: EXTERNAL attribute was already specified on 'p1'
26 !ERROR: POINTER attribute was already specified on 'p1'
27 !ERROR: The interface for procedure 'p1' has already been declared
28 procedure(sub), pointer :: p1 => null()
30 end module m2
32 module m3
33 interface
34 real function fun()
35 end function fun
36 end interface
38 procedure(fun), pointer :: f1 => null()
39 !ERROR: EXTERNAL attribute was already specified on 'f1'
40 !ERROR: POINTER attribute was already specified on 'f1'
41 !ERROR: The interface for procedure 'f1' has already been declared
42 procedure(fun), pointer :: f1 => null()
44 end module m3
46 module m4
47 real, dimension(:), pointer :: localArray => null()
48 type :: t2
49 real, dimension(:), pointer :: realArray => null()
50 !ERROR: Component 'realarray' is already declared in this derived type
51 real, dimension(:), pointer :: realArray => localArray
52 end type
53 end module m4
55 module m5
56 !ERROR: Actual argument for 'string=' has bad type 'REAL(4)'
57 character(len=len(a)) :: b
58 !ERROR: The type of 'a' has already been implicitly declared
59 character(len=len(b)) :: a
60 end module m5
62 module m6
63 integer, dimension(3) :: iarray
64 !ERROR: Derived type 'ubound' not found
65 character(len=ubound(iarray)(1)) :: first
66 end module m6
68 module m7
69 integer, dimension(2) :: iarray
70 !ERROR: Derived type 'ubound' not found
71 integer :: ivar = ubound(iarray)(1)
72 end module m7
74 module m8
75 integer :: iVar = 3
76 !ERROR: The type of 'ivar' has already been declared
77 integer :: iVar = 4
78 integer, target :: jVar = 5
79 integer, target :: kVar = 5
80 integer, pointer :: pVar => jVar
81 !ERROR: POINTER attribute was already specified on 'pvar'
82 !ERROR: The type of 'pvar' has already been declared
83 integer, pointer :: pVar => kVar
84 end module m8