92 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in failed_images() function calls3 4program failed_images_test5 use iso_fortran_env, only: team_type6 use iso_c_binding, only: c_int32_t7 implicit none8 9 type(team_type) home, league(2)10 integer n, i, array(1)11 integer, allocatable :: failure(:)12 integer, allocatable :: wrong_rank(:,:)13 logical non_integer, non_team14 character, allocatable :: wrong_result(:)15 16 !___ standard-conforming statement with no optional arguments present ___17 failure = failed_images()18 19 !___ standard-conforming statements with optional team argument present ___20 failure = failed_images(home)21 failure = failed_images(team=home)22 failure = failed_images(league(1))23 24 !___ standard-conforming statements with optional kind argument present ___25 failure = failed_images(kind=c_int32_t)26 27 !___ standard-conforming statements with both optional arguments present ___28 failure = failed_images(home, c_int32_t)29 failure = failed_images(team=home, kind=c_int32_t)30 failure = failed_images(kind=c_int32_t, team=home)31 32 !___ non-conforming statements ___33 34 !ERROR: Actual argument for 'team=' has bad type 'LOGICAL(4)'35 failure = failed_images(non_team)36 37 ! non-scalar team_type argument38 !ERROR: 'team=' argument has unacceptable rank 139 failure = failed_images(league)40 41 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'42 failure = failed_images(team=-1)43 44 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'45 failure = failed_images(team=i, kind=c_int32_t)46 47 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'48 failure = failed_images(i, c_int32_t)49 50 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'51 failure = failed_images(c_int32_t)52 53 ! non constant54 !ERROR: 'kind=' argument must be a constant scalar integer whose value is a supported kind for the intrinsic result type55 failure = failed_images(kind=i)56 57 ! non integer58 !ERROR: Actual argument for 'kind=' has bad type 'LOGICAL(4)'59 failure = failed_images(home, non_integer)60 !ERROR: Actual argument for 'kind=' has bad type 'LOGICAL(4)'61 failure = failed_images(kind=non_integer)62 63 ! non-scalar64 !ERROR: 'kind=' argument has unacceptable rank 165 failure = failed_images(kind=array)66 67 !ERROR: too many actual arguments for intrinsic 'failed_images'68 failure = failed_images(home, c_int32_t, 3)69 70 !ERROR: Actual argument for 'team=' has bad type 'REAL(4)'71 failure = failed_images(3.4)72 73 !ERROR: unknown keyword argument to intrinsic 'failed_images'74 failure = failed_images(kinds=c_int32_t)75 76 !ERROR: unknown keyword argument to intrinsic 'failed_images'77 failure = failed_images(home, kinds=c_int32_t)78 79 !ERROR: unknown keyword argument to intrinsic 'failed_images'80 failure = failed_images(my_team=home)81 82 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)83 n = failed_images()84 85 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches rank 2 array of INTEGER(4) and rank 1 array of INTEGER(4)86 wrong_rank = failed_images()87 88 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CHARACTER(KIND=1) and INTEGER(4)89 wrong_result = failed_images()90 91end program failed_images_test92