48 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in this_image() function calls3 4subroutine test5 use, intrinsic :: iso_fortran_env, only: team_type6 type(team_type) :: team7 !ERROR: Coarray 'coteam' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR8 type(team_type) :: coteam[*]9 integer :: coscalar[*], coarray(3)[*]10 save :: coteam, coscalar, coarray11 real, save :: coarray1[*], coarray2[2,*], coarray3[2,3,*]12 integer indices(3)13 14 ! correct calls, should produce no errors15 team = get_team()16 print *, this_image()17 print *, this_image(team)18 print *, this_image(coarray)19 print *, this_image(coarray, team)20 print *, this_image(coarray, 1)21 print *, this_image(coarray, 1, team)22 print *, this_image(coarray(1))23 print *, this_image(coarray(1), team)24 print *, this_image(coarray(1), 1)25 print *, this_image(coarray(1), 1, team)26 print *, this_image(coscalar)27 print *, this_image(coscalar, team)28 print *, this_image(coscalar, 1)29 print *, this_image(coscalar, 1, team)30 31 !ERROR: 'coarray=' argument must have corank > 0 for intrinsic 'this_image'32 print *, this_image(array,1)33 34 print *, team_number()35 print *, team_number(team)36 37 indices(1:1) = this_image(coarray1) ! ok38 indices(1:2) = this_image(coarray2) ! ok39 indices(1:3) = this_image(coarray3) ! ok40 !ERROR: Dimension 1 of left-hand side has extent 2, but right-hand side has extent 141 indices(1:2) = this_image(coarray1)42 !ERROR: Dimension 1 of left-hand side has extent 3, but right-hand side has extent 243 indices(1:3) = this_image(coarray2)44 !ERROR: Dimension 1 of left-hand side has extent 1, but right-hand side has extent 345 indices(1:1) = this_image(coarray3)46 47end subroutine48