aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/gomp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/gomp')
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/allocate-14.f9041
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/allocate-16.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/allocate-5.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/allocators-3.f9036
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/allocators-4.f909
5 files changed, 105 insertions, 8 deletions
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90
index 8ff9c252e49..4fed19249a3 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-14.f90
@@ -93,3 +93,44 @@ subroutine c_and_func_ptrs
!$omp allocate(cfunptr) ! OK? A normal derived-type var?
!$omp allocate(p) ! { dg-error "Argument 'p' at .1. to declarative !.OMP ALLOCATE directive must be a variable" }
end
+
+
+subroutine coarray_2
+ use m
+ implicit none
+ integer :: x
+ integer, allocatable :: a, b, c[:], d
+ x = 5 ! executable stmt
+ !$omp allocate(a,b) align(16)
+ !$omp allocate ! { dg-error "Unexpected coarray 'c' in 'allocate' at .1., implicitly listed in '!.OMP ALLOCATE' at .2." }
+ !$omp allocate(d) align(32)
+ allocate(a,b,c[*],d) ! { dg-error "Unexpected coarray 'c' in 'allocate' at .1., implicitly listed in '!.OMP ALLOCATE' at .2." }
+end
+
+
+subroutine coarray_3
+ use m
+ implicit none
+ integer :: x
+ integer, allocatable :: a, b, c[:], d
+ x = 5 ! executable stmt
+ !$omp allocators allocate(align(16): a,b) allocate(align(32) : d)
+ allocate(a,b,c[*],d) ! OK - Fortran allocator used for 'C'
+end
+
+
+subroutine unclear
+ use m
+ implicit none
+ integer :: x
+ integer, allocatable :: a, b, c[:], d
+
+ ! OpenMP is unclear which allocator is used for 'C' - the fortran one or the OpenMP one.
+ ! GCC therefore rejects it.
+
+ x = 5 ! executable stmt
+
+ !$omp allocate(a,b) align(16)
+ !$omp allocate(d) align(32)
+ allocate(a,b,c[*],d) ! { dg-error "'c' listed in 'allocate' statement at .1. but it is neither explicitly in listed in the '!.OMP ALLOCATE' directive nor exists a directive without argument list" }
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90
new file mode 100644
index 00000000000..6c203e02d57
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-16.f90
@@ -0,0 +1,10 @@
+integer, pointer :: ptr
+
+!$omp flush
+!$omp allocate(ptr)
+allocate(ptr)
+end
+
+! { dg-error "'!.OMP ALLOCATE' at .1. requires '-fopenmp-allocators'" "" { target *-*-* } 4 }
+! { dg-warning "All files that might deallocate such a variable must be compiled with '-fopenmp-allocators'" "" { target *-*-* } 4 }
+! { dg-note "This includes explicit DEALLOCATE, reallocation on intrinsic assignment, INTENT\\(OUT\\) for allocatable dummy arguments, and reallocation of allocatable components allocated with an OpenMP allocator" "" { target *-*-* } 0 }
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90 b/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90
index bf9c781dcc5..28369ae876b 100644
--- a/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/allocate-5.f90
@@ -1,3 +1,4 @@
+! { dg-additional-options "-fopenmp-allocators" }
module my_omp_lib
use iso_c_binding, only: c_intptr_t
!use omp_lib
@@ -45,15 +46,15 @@ subroutine two(c,x2,y2)
class(t), pointer :: y2(:)
!$omp flush ! some executable statement
- !$omp allocate(a) ! { dg-message "not yet supported" }
- allocate(a,b(4),c(3,4))
- deallocate(a,b,c)
+ !$omp allocate(a)
+ allocate(a)
+ deallocate(a)
- !$omp allocate(x1,y1,x2,y2) ! { dg-message "not yet supported" }
+ !$omp allocate(x1,y1,x2,y2)
allocate(x1,y1,x2(5),y2(5))
deallocate(x1,y1,x2,y2)
- !$omp allocate(b,a) align ( 128 ) ! { dg-message "not yet supported" }
+ !$omp allocate(b,a) align ( 128 )
!$omp allocate align ( 64 )
allocate(a,b(4),c(3,4))
deallocate(a,b,c)
@@ -66,7 +67,7 @@ subroutine three(c)
integer, allocatable :: a, b(:), c(:,:)
call foo() ! executable stmt
- !$omp allocate allocator( omp_large_cap_mem_alloc ) , align(64) ! { dg-message "not yet supported" }
+ !$omp allocate allocator( omp_large_cap_mem_alloc ) , align(64)
!$omp allocate(b) allocator( omp_high_bw_mem_alloc )
!$omp allocate(c) allocator( omp_high_bw_mem_alloc )
allocate(a,b(4),c(3,4))
@@ -74,7 +75,7 @@ subroutine three(c)
block
q = 5 ! executable stmt
- !$omp allocate(a) align(64) ! { dg-message "not yet supported" }
+ !$omp allocate(a) align(64)
!$omp allocate(b) allocator( omp_high_bw_mem_alloc ), align(32)
!$omp allocate(c) allocator( omp_thread_mem_alloc )
allocate(a,b(4),c(3,4))
@@ -84,7 +85,7 @@ subroutine three(c)
contains
subroutine inner
call foo() ! executable stmt
- !$omp allocate(a) align(64) ! { dg-message "not yet supported" }
+ !$omp allocate(a) align(64)
!$omp allocate(b) allocator( omp_high_bw_mem_alloc ), align(32)
!$omp allocate(c) allocator( omp_thread_mem_alloc )
allocate(a,b(4),c(3,4))
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90 b/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90
new file mode 100644
index 00000000000..d0e31ee8727
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/allocators-3.f90
@@ -0,0 +1,36 @@
+subroutine f
+ integer, allocatable :: A1, A2, B(:), C
+ !$omp declare target
+
+ !$omp allocators ! OK
+ allocate(A1)
+
+ !$omp allocators allocate(align(8) : a2) ! { dg-error "ALLOCATORS directive at .1. inside a target region must specify an ALLOCATOR modifier for 'a2'" }
+ allocate(A2)
+
+ !$omp allocate ! { dg-error "ALLOCATE directive at .1. inside a target region must specify an ALLOCATOR clause" }
+ allocate(B(5))
+
+ !$omp allocate(c) ! { dg-error "ALLOCATE directive at .1. inside a target region must specify an ALLOCATOR clause for 'c'" }
+ allocate(C)
+end
+
+subroutine g
+ integer, allocatable :: A1, A2, B(:), C
+
+ !$omp target
+ !$omp single
+ !$omp allocators ! OK
+ allocate(A1)
+
+ !$omp allocators allocate(align(8) : a2) ! { dg-error "ALLOCATORS directive at .1. inside a target region must specify an ALLOCATOR modifier for 'a2'" }
+ allocate(A2)
+
+ !$omp allocate ! { dg-error "ALLOCATE directive at .1. inside a target region must specify an ALLOCATOR clause" }
+ allocate(B(5))
+
+ !$omp allocate(c) ! { dg-error "ALLOCATE directive at .1. inside a target region must specify an ALLOCATOR clause for 'c'" }
+ allocate(C)
+ !$omp end single
+ !$omp end target
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/allocators-4.f90 b/gcc/testsuite/gfortran.dg/gomp/allocators-4.f90
new file mode 100644
index 00000000000..55ae48d61f2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/allocators-4.f90
@@ -0,0 +1,9 @@
+integer, pointer :: ptr
+
+!$omp allocators allocate(ptr)
+allocate(ptr)
+end
+
+! { dg-error "'!.OMP ALLOCATORS' at .1. requires '-fopenmp-allocators'" "" { target *-*-* } 3 }
+! { dg-warning "All files that might deallocate such a variable must be compiled with '-fopenmp-allocators'" "" { target *-*-* } 3 }
+! { dg-note "This includes explicit DEALLOCATE, reallocation on intrinsic assignment, INTENT\\(OUT\\) for allocatable dummy arguments, and reallocation of allocatable components allocated with an OpenMP allocator" "" { target *-*-* } 0 }