117 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Tests for F'2023 C1130:3! A variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not4! have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of5! finalizable type; shall not be a nonpointer polymorphic dummy argument; and6! shall not be a coarray or an assumed-size array.7 8subroutine s1()9! Cannot have ALLOCATABLE variable in a LOCAL/LOCAL_INIT locality spec10 integer, allocatable :: k11!ERROR: ALLOCATABLE variable 'k' not allowed in a LOCAL locality-spec12 do concurrent(i=1:5) local(k)13 end do14!ERROR: ALLOCATABLE variable 'k' not allowed in a LOCAL_INIT locality-spec15 do concurrent(i=1:5) local_init(k)16 end do17end subroutine s118 19subroutine s2(arg)20! Cannot have a dummy OPTIONAL in a locality spec21 integer, optional :: arg22!ERROR: OPTIONAL argument 'arg' not allowed in a locality-spec23 do concurrent(i=1:5) local(arg)24 end do25end subroutine s226 27subroutine s3(arg)28! This is OK29 real :: arg30 do concurrent(i=1:5) local(arg)31 end do32end subroutine s333 34subroutine s4(arg)35! Cannot have a dummy INTENT(IN) in a locality spec36 real, intent(in) :: arg37!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec38 do concurrent(i=1:5) local(arg)39 end do40end subroutine s441 42module m43! Cannot have a variable of a finalizable type in a LOCAL locality spec44 type t145 integer :: i46 contains47 final :: f48 end type t149 contains50 subroutine s5()51 type(t1) :: var52 !ERROR: Finalizable variable 'var' not allowed in a LOCAL locality-spec53 do concurrent(i=1:5) local(var)54 end do55 end subroutine s556 subroutine f(x)57 type(t1) :: x58 end subroutine f59end module m60 61subroutine s662! Cannot have a nonpointer polymorphic dummy argument in a LOCAL locality spec63 type :: t64 integer :: field65 end type t66contains67 subroutine s(x, y)68 class(t), pointer :: x69 class(t) :: y70 71! This is allowed72 do concurrent(i=1:5) local(x)73 end do74 75! This is not allowed76!ERROR: Nonpointer polymorphic argument 'y' not allowed in a LOCAL locality-spec77 do concurrent(i=1:5) local(y)78 end do79 end subroutine s80end subroutine s681 82subroutine s7()83! Cannot have a coarray84 integer, codimension[*], save :: coarray_var85!ERROR: Coarray 'coarray_var' not allowed in a LOCAL locality-spec86 do concurrent(i=1:5) local(coarray_var)87 end do88end subroutine s789 90subroutine s8(arg)91! Cannot have an assumed size array92 integer, dimension(*) :: arg93!ERROR: Assumed size array 'arg' not allowed in a locality-spec94 do concurrent(i=1:5) local(arg)95 end do96end subroutine s897 98subroutine s9()99 type l3100 integer, allocatable :: a101 end type102 type l2103 type(l3) :: l2_3104 end type105 type l1106 type(l2) :: l1_2107 end type108 type(l1) :: v109 integer sum110 111 sum = 0112!ERROR: Derived type variable 'v' with ultimate ALLOCATABLE component '%l1_2%l2_3%a' not allowed in a LOCAL_INIT locality-spec113 do concurrent (i = 1:10) local_init(v)114 sum = sum + i115 end do116end subroutine s9117