brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · b5871c3 Raw
129 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! XFAIL: *3! Check for semantic errors in this_image() function calls4 5program this_image_tests6  use iso_fortran_env, only : team_type7  implicit none8 9  !ERROR: Coarray 'team_coarray' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR10  type(team_type) team_coarray[*]11  type(team_type) home, league(2)12  integer n, i, array(1), non_coarray(1), co_array[*]13  integer, allocatable :: images(:)14  logical non_integer15 16  !___ standard-conforming statement with no optional arguments present ___17  n = this_image()18 19  !___ standard-conforming statements with team argument present ___20  n = this_image(home)21  n = this_image(team=home)22  n = this_image(league(1))23 24  !___ standard-conforming statements with coarray argument present ___25  images = this_image(co_array)26  images = this_image(coarray=co_array)27 28  !___ standard-conforming statements with coarray and team arguments present ___29  images = this_image(co_array, home)30  images = this_image(co_array, team=home)31  images = this_image(team_coarray, team=home)32  images = this_image(team_coarray[1], team=home)33  images = this_image(coarray=co_array, team=home)34  images = this_image(team=home, coarray=co_array)35 36  !___ standard-conforming statements with coarray and dim arguments present ___37  n = this_image(co_array, i)38  n = this_image(co_array, dim=i)39  n = this_image(coarray=co_array, dim=i)40  n = this_image(dim=i, coarray=co_array)41 42  !___ standard-conforming statements with all arguments present ___43  n = this_image(co_array, i, home)44  n = this_image(co_array, i, team=home)45  n = this_image(co_array, dim=i, team=home)46  n = this_image(co_array, team=home, dim=i)47 48  n = this_image(coarray=co_array, dim=i, team=home)49  n = this_image(coarray=co_array, team=home, dim=i)50 51  n = this_image(dim=i, coarray=co_array, team=home)52  n = this_image(dim=i, team=home, coarray=co_array)53 54  n = this_image(team=home, dim=i, coarray=co_array)55  n = this_image(team=home, coarray=co_array, dim=i)56 57  !___ non-conforming statements ___58 59  !ERROR: TBD60  n = this_image(co_array)61 62  !ERROR: missing mandatory 'dim=' argument63  n = this_image(i)64 65  !ERROR: missing mandatory 'coarray=' argument66  n = this_image(dim=i)67 68  !ERROR: Actual argument for 'dim=' has bad type 'team_type'69  n = this_image(i, home)70 71  !ERROR: missing mandatory 'dim=' argument72  n = this_image(i, team=home)73 74  !ERROR: TBD75  n = this_image(coarray=co_array, dim=2)76 77  !ERROR: missing mandatory 'coarray=' argument78  n = this_image(dim=i, team=home)79 80  !ERROR: missing mandatory 'coarray=' argument81  n = this_image(team=home, dim=i)82 83  ! Doesn't produce an error84  n = this_image(coarray=co_array, i)85 86  !ERROR: No explicit type declared for 'team'87  images = this_image(coarray=co_array, team)88 89  ! non-scalar team_type argument 90  !ERROR: missing mandatory 'coarray=' argument91  n = this_image(team=league)92 93  ! incorrectly typed argument94  !ERROR: missing mandatory 'dim=' argument95  n = this_image(3.4)96 97  !ERROR: too many actual arguments for intrinsic 'this_image'98  n = this_image(co_array, i, home, 0)99 100  ! keyword argument with incorrect type101  !ERROR: missing mandatory 'dim=' argument102  images = this_image(coarray=non_coarray)103 104  ! incorrect keyword argument name but valid type (type number)105  !ERROR: unknown keyword argument to intrinsic 'this_image'106  images = this_image(co_array=co_array)107 108  ! incorrect keyword argument name but valid type (team_type)109  !ERROR: unknown keyword argument to intrinsic 'this_image'110  n = this_image(my_team=home)111 112  ! correct keyword argument name but mismatched type113  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'114  n = this_image(co_array, i, team=-1)115 116  !ERROR: 'dim=' argument has unacceptable rank 1117  n = this_image(co_array, array )118 119  !ERROR: unknown keyword argument to intrinsic 'this_image'120  n = this_image(co_array, dims=i)121 122  !ERROR: Actual argument for 'dim=' has bad type 'LOGICAL(4)'123  n = this_image(co_array, non_integer)124 125  ! A this_image reference with a coarray argument of team type shall also have a team argument126  ! Doesn't produce an error127  images = this_image(team_coarray)128end program this_image_tests129