1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3subroutine s1
4  type :: t
5    integer :: i
6    integer :: s1
7    integer :: t
8  end type
9  !ERROR: 't' is already declared in this scoping unit
10  integer :: t
11  integer :: i, j
12  type(t) :: x
13  !ERROR: Derived type 't2' not found
14  type(t2) :: y
15  external :: v
16  type(t) :: v, w
17  external :: w
18  !ERROR: 'z' is not an object of derived type; it is implicitly typed
19  i = z%i
20  !ERROR: 's1' is an invalid base for a component reference
21  i = s1%i
22  !ERROR: 'j' is not an object of derived type
23  i = j%i
24  !ERROR: Component 'j' not found in derived type 't'
25  i = x%j
26  !ERROR: 'v' is an invalid base for a component reference
27  i = v%i
28  !ERROR: 'w' is an invalid base for a component reference
29  i = w%i
30  i = x%i  !OK
31end subroutine
32
33subroutine s2
34  type :: t1
35    integer :: i
36  end type
37  type :: t2
38    type(t1) :: x
39  end type
40  type(t2) :: y
41  integer :: i
42  !ERROR: Component 'j' not found in derived type 't1'
43  k = y%x%j
44  k = y%x%i !OK
45end subroutine
46