119 lines · plain
1!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=602 3subroutine f004 integer :: x, v5 ! The end-directive is optional in ATOMIC READ. Expect no diagnostics.6 !$omp atomic read7 v = x8 9 !$omp atomic read10 v = x11 !$omp end atomic12end13 14subroutine f0115 integer, pointer :: x, v16 ! Intrinsic assignment and pointer assignment are both ok. Expect no17 ! diagnostics.18 !$omp atomic read19 v = x20 21 !$omp atomic read22 v => x23end24 25subroutine f02(i)26 integer :: i, v27 interface28 function p(i)29 integer, pointer :: p30 integer :: i31 end32 end interface33 34 ! Atomic variable can be a function reference. Expect no diagostics.35 !$omp atomic read36 v = p(i)37end38 39subroutine f0340 integer :: x(3), y(5), v(3)41 42 !$omp atomic read43 !ERROR: Atomic variable x should be a scalar44 v = x45 46 !$omp atomic read47 !ERROR: Atomic variable y(2_8:4_8:1_8) should be a scalar48 v = y(2:4)49end50 51subroutine f0452 integer :: x, y(3), v53 54 !$omp atomic read55 !ERROR: Within atomic operation x and x access the same storage56 x = x57 58 ! Accessing same array, but not the same storage. Expect no diagnostics.59 !$omp atomic read60 y(1) = y(2)61end62 63subroutine f0564 integer :: x, v65 66 !$omp atomic read67 !ERROR: Atomic expression x+1_4 should be a variable68 v = x + 169end70 71subroutine f0672 character :: x, v73 74 !$omp atomic read75 !ERROR: Atomic variable x cannot have CHARACTER type76 v = x77end78 79subroutine f0780 integer, allocatable :: x81 integer :: v82 83 allocate(x)84 85 !$omp atomic read86 !ERROR: Atomic variable x cannot be ALLOCATABLE87 v = x88end89 90subroutine f0891 type :: struct92 integer :: m93 end type94 type(struct) :: x, v95 96 !$omp atomic read97 !ERROR: Atomic variable x should have an intrinsic type98 v = x99end100 101subroutine f09(x, v)102 class(*), pointer :: x, v103 104 !$omp atomic read105 !ERROR: Atomic variable x cannot be a pointer to a polymorphic type106 v => x107end108 109subroutine f10(x, v)110 type struct(length)111 integer, len :: length112 end type113 type(struct(*)), pointer :: x, v114 115 !$omp atomic read116 !ERROR: Atomic variable x is a pointer to a type with non-constant length parameter117 v => x118end119