1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3subroutine s1
4  implicit none
5  real(8) :: x = 2.0
6  !ERROR: The associate name 'a' is already used in this associate statement
7  associate(a => x, b => x+1, a => x+2)
8    x = b
9  end associate
10  !ERROR: No explicit type declared for 'b'
11  x = b
12end
13
14subroutine s2
15  !ERROR: Associate name 'a' must have a type
16  associate (a => z'1')
17  end associate
18end
19
20subroutine s3
21! Test that associated entities are not preventing to fix
22! mis-parsed function references into array references
23  real :: a(10)
24  associate (b => a(2:10:2))
25    ! Check no complains about "Use of 'b' as a procedure"
26    print *, b(1) ! OK
27  end associate
28  associate (c => a(2:10:2))
29    ! Check the function reference has been fixed to an array reference
30    !ERROR: Reference to array 'c' with empty subscript list
31    print *, c()
32  end associate
33end
34