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