brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · aa0ae45 Raw
135 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Tests for the last sentence of C1128:3!A variable-name that is not permitted to appear in a variable definition4!context shall not appear in a LOCAL or LOCAL_INIT locality-spec.5 6subroutine s1(arg)7  real, intent(in) :: arg8 9  ! This is not OK because "arg" is "intent(in)"10!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec11  do concurrent (i=1:5) local(arg)12  end do13end subroutine s114 15subroutine s2(arg)16  real, value, intent(in) :: arg17 18  ! This is not OK even though "arg" has the "value" attribute.  C112819  ! explicitly excludes dummy arguments of INTENT(IN)20!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec21  do concurrent (i=1:5) local(arg)22  end do23end subroutine s224 25module m326  real, protected :: prot27  real var28 29  contains30    subroutine sub()31      ! C857 This is OK because of the "protected" attribute only applies to32      ! accesses outside the module33      do concurrent (i=1:5) local(prot)34      end do35    end subroutine sub36endmodule m337 38subroutine s4()39  use m340 41  ! C857 This is not OK because of the "protected" attribute42!ERROR: 'prot' may not appear in a locality-spec because it is not definable43!BECAUSE: 'prot' is protected in this scope44  do concurrent (i=1:5) local(prot)45  end do46 47  ! C857 This is OK because of there's no "protected" attribute48  do concurrent (i=1:5) local(var)49  end do50end subroutine s451 52subroutine s5()53  real :: a, b, c, d, e54 55  associate (a => b + c, d => e)56    b = 3.057    ! C1101 This is OK because 'd' is associated with a variable58    do concurrent (i=1:5) local(d)59    end do60 61    ! C1101 This is not OK because 'a' is not associated with a variable62!ERROR: 'a' may not appear in a locality-spec because it is not definable63!BECAUSE: 'a' is construct associated with an expression64    do concurrent (i=1:5) local(a)65    end do66  end associate67end subroutine s568 69subroutine s6()70  type point71    real :: x, y72  end type point73 74  type, extends(point) :: color_point75    integer :: color76  end type color_point77 78  type(point), target :: c, d79  class(point), pointer :: p_or_c80 81  p_or_c => c82  select type ( a => p_or_c )83  type is ( point )84    ! C1158 This is OK because 'a' is associated with a variable85    do concurrent (i=1:5) local(a)86    end do87  end select88 89  select type ( a => func() )90  type is ( point )91    ! C1158 This is OK because 'a' is associated with a variable92    do concurrent (i=1:5) local(a)93    end do94  end select95 96  select type ( a => (func()) )97  type is ( point )98    ! C1158 This is not OK because 'a' is not associated with a variable99!ERROR: 'a' may not appear in a locality-spec because it is not definable100!BECAUSE: 'a' is construct associated with an expression101    do concurrent (i=1:5) local(a)102    end do103  end select104 105  contains106    function func()107      class(point), pointer :: func108      func => c109    end function func110end subroutine s6111 112module m4113  real, protected :: prot114  real var115endmodule m4116 117pure subroutine s7()118  use m4119 120  ! C1594 This is not OK because we're in a PURE subroutine121!ERROR: 'var' may not appear in a locality-spec because it is not definable122!BECAUSE: 'var' may not be defined in pure subprogram 's7' because it is USE-associated123  do concurrent (i=1:5) local(var)124  end do125end subroutine s7126 127subroutine s8()128  integer, parameter :: iconst = 343129 130!ERROR: 'iconst' may not appear in a locality-spec because it is not definable131!BECAUSE: 'iconst' is not a variable132  do concurrent (i=1:5) local(iconst)133  end do134end subroutine s8135