gcc/fortran/
[official-gcc.git] / gcc / testsuite / gfortran.dg / coarray_atomic_1.f90
blob107f076f130692c6d68036e55dbca5b748d090bf
1 ! { dg-do compile }
2 ! { dg-options "-fcoarray=single -std=f2008" }
4 ! PR fortran/18918
6 ! Diagnostic for atomic subroutines
8 use iso_fortran_env, only: atomic_int_kind, atomic_logical_kind
9 implicit none
10 integer(atomic_int_kind) :: a(1)[*]
11 logical(1) :: c[*]
12 integer(atomic_int_kind) :: b
13 logical(atomic_logical_kind) :: d, e[*]
15 call atomic_define(a, 7_2) ! { dg-error "must be a scalar" }
16 call atomic_ref(b, b) ! { dg-error "shall be a coarray" }
18 call atomic_define(c, 7) ! { dg-error "an integer of ATOMIC_INT_KIND or a logical of ATOMIC_LOGICAL_KIND" }
19 call atomic_ref(d, a(1)) ! { dg-error "shall have the same type as 'atom'" }
20 call atomic_ref(.true., e) ! { dg-error "shall be definable" }
21 end