xref: /llvm-project/flang/test/Semantics/call37.f90 (revision 6ceba01a4d5c4482885348c71294d89f48579b51)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror
2! Test warnings on mismatching interfaces involvingCHARACTER arguments
3subroutine constLen(s)
4  character(len = 1) s
5end
6subroutine assumedLen(s)
7  character(len = *) s
8end
9subroutine exprLen(s)
10  common n
11  character(len = n) s
12end
13
14module m0
15  interface ! these are all OK
16    subroutine constLen(s)
17      character(len=1) s
18    end
19    subroutine assumedLen(s)
20      character(len=*) s
21    end
22    subroutine exprLen(s)
23      common n
24      character(len=n) s
25    end
26  end interface
27end
28
29module m1
30  interface
31    !WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: incompatible dummy data object types: CHARACTER(KIND=1,LEN=1_8) vs CHARACTER(KIND=1,LEN=2_8))
32    subroutine constLen(s)
33      character(len=2) s
34    end
35    !WARNING: The global subprogram 'assumedlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
36    subroutine assumedLen(s)
37      character(len=2) s
38    end
39    !WARNING: The global subprogram 'exprlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: constant-length vs non-constant-length character dummy arguments)
40    subroutine exprLen(s)
41      character(len=2) s
42    end
43  end interface
44end
45
46module m2
47  interface
48    !WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
49    subroutine constLen(s)
50      character(len=*) s
51    end
52    !WARNING: The global subprogram 'exprlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
53    subroutine exprLen(s)
54      character(len=*) s
55    end
56  end interface
57end
58
59module m3
60  interface
61    !WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: constant-length vs non-constant-length character dummy arguments)
62    subroutine constLen(s)
63      common n
64      character(len=n) s
65    end
66    !WARNING: The global subprogram 'assumedlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
67    subroutine assumedLen(s)
68      common n
69      character(len=n) s
70    end
71  end interface
72end
73