xref: /llvm-project/flang/test/Semantics/getcwd.f90 (revision 68413219dba47104fef388364a9973b584126f42)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2! Tests for the GETCWD intrinsics
3
4subroutine bad_kind_error(cwd, status)
5  CHARACTER(len=255) :: cwd
6  INTEGER(2) :: status
7  !ERROR: Actual argument for 'status=' has bad type or kind 'INTEGER(2)'
8  call getcwd(cwd, status)
9end subroutine bad_kind_error
10
11subroutine bad_args_error()
12  !ERROR: missing mandatory 'c=' argument
13  call getcwd()
14end subroutine bad_args_error
15
16subroutine bad_apply_form(cwd)
17  CHARACTER(len=255) :: cwd
18  INTEGER :: status
19  !Declaration of 'getcwd'
20  call getcwd(cwd, status)
21  !ERROR: Cannot call subroutine 'getcwd' like a function
22  status = getcwd(cwd)
23end subroutine bad_apply_form
24
25subroutine good_subroutine(cwd, status)
26  CHARACTER(len=255) :: cwd
27  INTEGER :: status
28  call getcwd(cwd, status)
29end subroutine good_subroutine
30
31subroutine good_function(cwd, status)
32  CHARACTER(len=255) :: cwd
33  INTEGER :: status
34  status = getcwd(cwd)
35end subroutine good_function