1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for semantic errors in failed_images() function calls
4 program failed_images_test
5 use iso_fortran_env
, only
: team_type
6 use iso_c_binding
, only
: c_int32_t
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_team
14 character, allocatable
:: wrong_result(:)
16 !___ standard-conforming statement with no optional arguments present ___
17 failure
= failed_images()
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))
24 !___ standard-conforming statements with optional kind argument present ___
25 failure
= failed_images(kind
=c_int32_t
)
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
)
32 !___ non-conforming statements ___
34 !ERROR: Actual argument for 'team=' has bad type 'LOGICAL(4)'
35 failure
= failed_images(non_team
)
37 ! non-scalar team_type argument
38 !ERROR: 'team=' argument has unacceptable rank 1
39 failure
= failed_images(league
)
41 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'
42 failure
= failed_images(team
=-1)
44 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'
45 failure
= failed_images(team
=i
, kind
=c_int32_t
)
47 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'
48 failure
= failed_images(i
, c_int32_t
)
50 !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'
51 failure
= failed_images(c_int32_t
)
54 !ERROR: 'kind=' argument must be a constant scalar integer whose value is a supported kind for the intrinsic result type
55 failure
= failed_images(kind
=i
)
58 !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
)
64 !ERROR: 'kind=' argument has unacceptable rank 1
65 failure
= failed_images(kind
=array
)
67 !ERROR: too many actual arguments for intrinsic 'failed_images'
68 failure
= failed_images(home
, c_int32_t
, 3)
70 !ERROR: Actual argument for 'team=' has bad type 'REAL(4)'
71 failure
= failed_images(3.4)
73 !ERROR: unknown keyword argument to intrinsic 'failed_images'
74 failure
= failed_images(kinds
=c_int32_t
)
76 !ERROR: unknown keyword argument to intrinsic 'failed_images'
77 failure
= failed_images(home
, kinds
=c_int32_t
)
79 !ERROR: unknown keyword argument to intrinsic 'failed_images'
80 failure
= failed_images(my_team
=home
)
82 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches scalar INTEGER(4) and rank 1 array of INTEGER(4)
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()
88 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CHARACTER(KIND=1) and INTEGER(4)
89 wrong_result
= failed_images()
91 end program failed_images_test