brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 8caab8e Raw
96 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in stopped_images() function calls3! as defined in 16.9.183 in the Fortran 2018 standard4 5program stopped_images_test6  use iso_fortran_env, only: team_type7  use iso_c_binding, only: c_int32_t, c_int64_t8  implicit none9 10  type(team_type) home, league(2)11  integer n, i, array(1), non_constant12  integer, allocatable :: stopped(:)13  integer, allocatable :: wrong_rank(:,:)14  logical non_integer, non_team15  character, allocatable :: wrong_result(:)16 17  !___ standard-conforming statement with no optional arguments present ___18  stopped = stopped_images()19 20  !___ standard-conforming statements with optional team argument present ___21  stopped = stopped_images(home)22  stopped = stopped_images(team=home)23  stopped = stopped_images(league(1))24 25  !___ standard-conforming statements with optional kind argument present ___26  stopped = stopped_images(kind=c_int32_t)27 28  !___ standard-conforming statements with both optional arguments present ___29  stopped = stopped_images(home, c_int32_t)30  stopped = stopped_images(team=home, kind=c_int32_t)31  stopped = stopped_images(kind=c_int32_t, team=home)32 33  !___ non-conforming statements ___34 35  !ERROR: Actual argument for 'team=' has bad type 'LOGICAL(4)'36  stopped = stopped_images(non_team)37 38  !ERROR: 'team=' argument has unacceptable rank 139  stopped = stopped_images(league)40 41  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'42  stopped = stopped_images(team=-1)43 44  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'45  stopped = stopped_images(team=i, kind=c_int32_t)46 47  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'48  stopped = stopped_images(i, c_int32_t)49 50  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'51  stopped = stopped_images(c_int32_t)52 53  !ERROR: repeated keyword argument to intrinsic 'stopped_images'54  stopped = stopped_images(team=home, team=league(1))55 56  !ERROR: 'kind=' argument must be a constant scalar integer whose value is a supported kind for the intrinsic result type57  stopped = stopped_images(kind=non_constant)58 59  !ERROR: Actual argument for 'kind=' has bad type 'LOGICAL(4)'60  stopped = stopped_images(home, non_integer)61 62  !ERROR: Actual argument for 'kind=' has bad type 'LOGICAL(4)'63  stopped = stopped_images(kind=non_integer)64 65  !ERROR: 'kind=' argument has unacceptable rank 166  stopped = stopped_images(kind=array)67 68  !ERROR: repeated keyword argument to intrinsic 'stopped_images'69  stopped = stopped_images(kind=c_int32_t, kind=c_int64_t)70 71  !ERROR: too many actual arguments for intrinsic 'stopped_images'72  stopped = stopped_images(home, c_int32_t, 3)73 74  !ERROR: Actual argument for 'team=' has bad type 'REAL(4)'75  stopped = stopped_images(3.4)76 77  !ERROR: unknown keyword argument to intrinsic 'stopped_images'78  stopped = stopped_images(kinds=c_int32_t)79 80  !ERROR: unknown keyword argument to intrinsic 'stopped_images'81  stopped = stopped_images(home, kinds=c_int32_t)82 83  !ERROR: unknown keyword argument to intrinsic 'stopped_images'84  stopped = stopped_images(my_team=home)85 86  !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)87  n = stopped_images()88 89  !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches rank 2 array of INTEGER(4) and rank 1 array of INTEGER(4)90  wrong_rank = stopped_images()91 92  !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CHARACTER(KIND=1) and INTEGER(4)93  wrong_result = stopped_images()94 95end program stopped_images_test96