brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · bcd1a7e Raw
144 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! This test checks for semantic errors in co_broadcast subroutine calls based on3! the co_broadcast interface defined in section 16.9.46 of the Fortran 2018 standard.4! To Do: add co_broadcast to the list of intrinsics5 6program test_co_broadcast7  implicit none8 9  type foo_t10  end type11 12  integer          i, integer_array(1), coindexed_integer[*], status, coindexed_source_image[*], repeated_status13  character(len=1) c, character_array(1), coindexed_character[*], message, repeated_message14  double precision d, double_precision_array(1)15  type(foo_t)      f16  real             r, real_array(1), coindexed_real[*]17  complex          z, complex_array18  logical bool19 20  !___ standard-conforming calls with no keyword arguments ___21  call co_broadcast(i, 1)22  call co_broadcast(c, 1)23  call co_broadcast(d, 1)24  call co_broadcast(f, 1)25  call co_broadcast(r, 1)26  call co_broadcast(z, 1)27  call co_broadcast(i, 1, status)28  call co_broadcast(i, 1, status, message)29 30  !___ standard-conforming calls with keyword arguments ___31 32  ! all arguments present33  call co_broadcast(a=i, source_image=1, stat=status, errmsg=message)34  call co_broadcast(source_image=1, a=i, errmsg=message, stat=status)35 36  ! one optional argument not present37  call co_broadcast(a=d, source_image=1,              errmsg=message)38  call co_broadcast(a=f, source_image=1, stat=status                )39 40  ! two optional arguments not present41  call co_broadcast(a=r, source_image=1                             )42  call co_broadcast(a=r, source_image=coindexed_source_image        )43 44  !___ non-standard-conforming calls ___45 46  !ERROR: missing mandatory 'a=' argument47  call co_broadcast()48 49  !ERROR: repeated keyword argument to intrinsic 'co_broadcast'50  call co_broadcast(a=i, a=c)51 52  !ERROR: repeated keyword argument to intrinsic 'co_broadcast'53  call co_broadcast(d, source_image=1, source_image=3)54 55  !ERROR: repeated keyword argument to intrinsic 'co_broadcast'56  call co_broadcast(d, 1, stat=status, stat=repeated_status)57 58  !ERROR: repeated keyword argument to intrinsic 'co_broadcast'59  call co_broadcast(d, 1, status, errmsg=message, errmsg=repeated_message)60 61  !ERROR: keyword argument to intrinsic 'co_broadcast' was supplied positionally by an earlier actual argument62  call co_broadcast(i, 1, a=c)63 64  !ERROR: keyword argument to intrinsic 'co_broadcast' was supplied positionally by an earlier actual argument65  call co_broadcast(i, 1, status, source_image=1)66 67  !ERROR: keyword argument to intrinsic 'co_broadcast' was supplied positionally by an earlier actual argument68  call co_broadcast(i, 1, status, stat=repeated_status)69 70  !ERROR: keyword argument to intrinsic 'co_broadcast' was supplied positionally by an earlier actual argument71  call co_broadcast(i, 1, status, message, errmsg=repeated_message)72 73  !ERROR: missing mandatory 'a=' argument74  call co_broadcast(source_image=1, stat=status, errmsg=message)75 76  !ERROR: missing mandatory 'source_image=' argument77  call co_broadcast(c)78 79  !ERROR: missing mandatory 'source_image=' argument80  call co_broadcast(a=c, stat=status, errmsg=message)81 82  !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'a=' is not definable83  !BECAUSE: '2_4' is not a variable or pointer84  call co_broadcast(a=1+1, source_image=1)85 86  !ERROR: 'a' argument to 'co_broadcast' may not be a coindexed object87  call co_broadcast(a=coindexed_real[1], source_image=1)88 89  ! 'source_image' argument shall be an integer90  !ERROR: Actual argument for 'source_image=' has bad type 'LOGICAL(4)'91  call co_broadcast(i, source_image=bool)92 93  ! 'source_image' argument shall be an integer scalar94  !ERROR: 'source_image=' argument has unacceptable rank 195  call co_broadcast(c, source_image=integer_array)96 97  !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'stat=' is not definable98  !BECAUSE: '2_4' is not a variable or pointer99  call co_broadcast(a=i, source_image=1, stat=1+1, errmsg=message)100 101  !ERROR: 'stat' argument to 'co_broadcast' may not be a coindexed object102  call co_broadcast(d, stat=coindexed_integer[1], source_image=1)103 104  ! 'stat' argument shall be an integer105  !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)'106  call co_broadcast(r, stat=message, source_image=1)107 108  !ERROR: 'stat=' argument has unacceptable rank 1109  call co_broadcast(i, stat=integer_array, source_image=1)110 111  !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'errmsg=' is not definable112  !BECAUSE: '"c"' is not a variable or pointer113  call co_broadcast(a=i, source_image=1, stat=status, errmsg='c')114 115  !ERROR: 'errmsg' argument to 'co_broadcast' may not be a coindexed object116  call co_broadcast(c, errmsg=coindexed_character[1], source_image=1)117 118  ! 'errmsg' argument shall be a character119  !ERROR: Actual argument for 'errmsg=' has bad type 'INTEGER(4)'120  call co_broadcast(c, 1, status, i)121 122  ! 'errmsg' argument shall be a character123  !ERROR: Actual argument for 'errmsg=' has bad type 'INTEGER(4)'124  call co_broadcast(c, errmsg=i, source_image=1)125 126  !ERROR: 'errmsg=' argument has unacceptable rank 1127  call co_broadcast(d, errmsg=character_array, source_image=1)128 129  !ERROR: actual argument #5 without a keyword may not follow an actual argument with a keyword130  call co_broadcast(r, source_image=1, stat=status, errmsg=message, 3.4)131 132  !ERROR: unknown keyword argument to intrinsic 'co_broadcast'133  call co_broadcast(fake=3.4)134 135  !ERROR: unknown keyword argument to intrinsic 'co_broadcast'136  call co_broadcast(a=i, result_image=1, stat=status, errmsg=message)137 138  !ERROR: 'a' argument to 'co_broadcast' may not be a coindexed object139  !ERROR: 'errmsg' argument to 'co_broadcast' may not be a coindexed object140  !ERROR: 'stat' argument to 'co_broadcast' may not be a coindexed object141  call co_broadcast(source_image=coindexed_source_image[1], a=coindexed_real[1], errmsg=coindexed_character[1], stat=coindexed_integer[1])142 143end program test_co_broadcast144