235 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! !DIR$ IGNORE_TKR tests3 4!ERROR: !DIR$ IGNORE_TKR directive must appear in a subroutine or function5!dir$ ignore_tkr6 7module m8 9!ERROR: !DIR$ IGNORE_TKR directive must appear in a subroutine or function10!dir$ ignore_tkr11 12 interface13 subroutine t1(x)14!dir$ ignore_tkr15 real, intent(in) :: x16 end17 18 subroutine t2(x)19!dir$ ignore_tkr(t) x20 real, intent(in) :: x21 end22 23 subroutine t3(x)24!dir$ ignore_tkr(k) x25 real, intent(in) :: x26 end27 28 subroutine t4(a)29!dir$ ignore_tkr(r) a30 real, intent(in) :: a(2)31 end32 33 subroutine t5(m)34!dir$ ignore_tkr(r) m35 real, intent(in) :: m(2,2)36 end37 38 subroutine t6(x)39!dir$ ignore_tkr(a) x40 real, intent(in) :: x41 end42 43 subroutine t7(x)44!ERROR: !DIR$ IGNORE_TKR directive may not have an empty parenthesized list of letters45!dir$ ignore_tkr() x46 real, intent(in) :: x47 end48 49 subroutine t8(x)50!dir$ ignore_tkr x51 real, intent(in) :: x52 end53 54 subroutine t9(x)55!dir$ ignore_tkr x56!WARNING: !DIR$ IGNORE_TKR should not apply to an allocatable or pointer [-Wignore-tkr-usage]57 real, intent(in), allocatable :: x58 end59 60 subroutine t10(x)61!dir$ ignore_tkr x62!WARNING: !DIR$ IGNORE_TKR should not apply to an allocatable or pointer [-Wignore-tkr-usage]63 real, intent(in), pointer :: x64 end65 66 subroutine t1167!dir$ ignore_tkr x68!ERROR: !DIR$ IGNORE_TKR directive may apply only to a dummy data argument69 real :: x70 end71 72 subroutine t12(p,q,r)73!dir$ ignore_tkr p, q74!ERROR: 'p' is a data object and may not be EXTERNAL75 real, external :: p76!ERROR: 'q' is already declared as an object77 procedure(real) :: q78 procedure(), pointer :: r79!ERROR: 'r' must be an object80!dir$ ignore_tkr r81 end82 83 elemental subroutine t13(x)84!dir$ ignore_tkr(r) x85!ERROR: !DIR$ IGNORE_TKR(R) may not apply in an ELEMENTAL procedure86 real, intent(in) :: x87 end88 89 subroutine t14(x)90!dir$ ignore_tkr(r) x91!WARNING: !DIR$ IGNORE_TKR(R) should not apply to a dummy argument passed via descriptor [-Wignore-tkr-usage]92 real x(:)93 end94 95 module subroutine t24(x)96!dir$ ignore_tkr(t) x97 real x(:)98 end99 100 end interface101 102 contains103 subroutine t15(x)104!dir$ ignore_tkr x105!ERROR: !DIR$ IGNORE_TKR may not apply to an allocatable or pointer106 real, intent(in), allocatable :: x107 end108 109 subroutine t16(x)110!dir$ ignore_tkr x111!ERROR: !DIR$ IGNORE_TKR may not apply to an allocatable or pointer112 real, intent(in), pointer :: x113 end114 115 subroutine t17(x)116 real x117 x = x + 1.118!ERROR: !DIR$ IGNORE_TKR directive must appear in the specification part119!dir$ ignore_tkr x120 end121 122 subroutine t18(x)123!ERROR: 'q' is not a valid letter for !DIR$ IGNORE_TKR directive124!dir$ ignore_tkr(q) x125 real x126 x = x + 1.127 end128 129 subroutine t19(x)130 real x131 contains132 subroutine inner133!ERROR: 'x' must be local to this subprogram134!dir$ ignore_tkr x135 end136 end137 138 subroutine t20(x)139 real x140 block141!ERROR: 'x' must be local to this subprogram142!dir$ ignore_tkr x143 end block144 end145 146 subroutine t22(x)147!dir$ ignore_tkr(r) x148!WARNING: !DIR$ IGNORE_TKR(R) is not meaningful for an assumed-rank array [-Wignore-tkr-usage]149 real x(..)150 end151 152 subroutine t23(x)153!dir$ ignore_tkr(r) x154!ERROR: !DIR$ IGNORE_TKR(R) may not apply to a dummy argument passed via descriptor155 real x(:)156 end157 158end159 160subroutine bad1(x)161!dir$ ignore_tkr x162!ERROR: !DIR$ IGNORE_TKR may apply only in an interface or a module procedure163 real, intent(in) :: x164end165 166submodule(m) subm167 contains168 module subroutine t24(x)169!dir$ ignore_tkr(t) x170 real x(:)171 end172end173 174program test175 176!ERROR: !DIR$ IGNORE_TKR directive must appear in a subroutine or function177!dir$ ignore_tkr178 179 use m180 real x181 real a(2)182 real m(2,2)183 double precision dx184 185 call t1(1)186 call t1(dx)187 call t1('a')188 call t1((1.,2.))189 call t1(.true.)190 191 call t2(1)192 !ERROR: Actual argument type 'REAL(8)' is not compatible with dummy argument type 'REAL(4)'193 call t2(dx)194 call t2('a')195 call t2((1.,2.))196 call t2(.true.)197 198 !ERROR: Actual argument type 'INTEGER(4)' is not compatible with dummy argument type 'REAL(4)'199 call t3(1)200 call t3(dx)201 !ERROR: passing Hollerith or character literal as if it were BOZ [-Whollerith-or-character-as-boz]202 call t3('a')203 !ERROR: Actual argument type 'COMPLEX(4)' is not compatible with dummy argument type 'REAL(4)'204 call t3((1.,2.))205 !ERROR: Actual argument type 'LOGICAL(4)' is not compatible with dummy argument type 'REAL(4)'206 call t3(.true.)207 208 call t4(x)209 call t4(m)210 call t5(x)211 !WARNING: Actual argument array has fewer elements (2) than dummy argument 'm=' array (4)212 call t5(a)213 214 call t6(1)215 call t6(dx)216 call t6('a')217 call t6((1.,2.))218 call t6(.true.)219 call t6(a)220 221 call t8(1)222 call t8(dx)223 call t8('a')224 call t8((1.,2.))225 call t8(.true.)226 call t8(a)227 228 contains229 subroutine inner(x)230!dir$ ignore_tkr x231!ERROR: !DIR$ IGNORE_TKR may apply only in an interface or a module procedure232 real, intent(in) :: x233 end234end235