xref: /llvm-project/flang/test/Semantics/resolve05.f90 (revision 1c91d9bdea3b6c38e8fbce46ec8181a9c0aa26f8)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2program p
3  !PORTABILITY: Name 'p' declared in a main program should not have the same name as the main program
4  integer :: p
5end
6module m
7  !PORTABILITY: Name 'm' declared in a module should not have the same name as the module
8  integer :: m
9end
10submodule(m) sm
11  !PORTABILITY: Name 'sm' declared in a submodule should not have the same name as the submodule
12  integer :: sm
13end
14block data bd
15  !PORTABILITY: Name 'bd' declared in a BLOCK DATA subprogram should not have the same name as the BLOCK DATA subprogram
16  type bd
17  end type
18end
19module m2
20  type :: t
21  end type
22  interface
23    subroutine s
24      !ERROR: Module 'm2' cannot USE itself
25      use m2, only: t
26    end subroutine
27  end interface
28end module
29subroutine s
30  !ERROR: 's' is already declared in this scoping unit
31  integer :: s
32end
33function f() result(res)
34  integer :: res
35  !ERROR: 'f' is already declared in this scoping unit
36  !ERROR: The type of 'f' has already been declared
37  real :: f
38  res = 1
39end
40