43 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Tests for the HOSTNM intrinsics.3 4subroutine bad_kind_error(cwd, status)5 CHARACTER(len=255) :: cwd6 INTEGER(2) :: status7 !ERROR: Actual argument for 'status=' has bad type or kind 'INTEGER(2)'8 call hostnm(cwd, status)9end subroutine bad_kind_error10 11subroutine bad_args_error()12 !ERROR: missing mandatory 'c=' argument13 call hostnm()14end subroutine bad_args_error15 16subroutine bad_function(cwd)17 CHARACTER(len=255) :: cwd18 INTEGER :: status19 call hostnm(cwd, status)20 !ERROR: Cannot call subroutine 'hostnm' like a function21 status = hostnm(cwd)22end subroutine bad_function23 24subroutine bad_sub(cwd)25 CHARACTER(len=255) :: cwd26 INTEGER :: status27 status = hostnm(cwd)28 !ERROR: Cannot call function 'hostnm' like a subroutine29 call hostnm(cwd, status)30end subroutine bad_sub31 32subroutine good_subroutine(cwd, status)33 CHARACTER(len=255) :: cwd34 INTEGER :: status35 call hostnm(cwd, status)36end subroutine good_subroutine37 38subroutine good_function(cwd, status)39 CHARACTER(len=255) :: cwd40 INTEGER :: status41 status = hostnm(cwd)42end subroutine good_function43