gcc/libgomp/testsuite/libgomp.fortran/alloc-5.f90
Tobias Burnus fff15bad1a libgomp: Add Fortran routine support for allocators
libgomp/ChangeLog:

	* allocator.c: Add ialias for omp_init_allocator and
	omp_destroy_allocator.
	* configure.ac: Set INTPTR_T_KIND.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* fortran.c (omp_init_allocator_, omp_destroy_allocator_,
	omp_set_default_allocator_, omp_get_default_allocator_): New
	functions and ialias_redirect.
	* icv.c: Add ialias for omp_set_default_allocator and
	omp_get_default_allocator.
	* libgomp.map (OMP_5.0.1): Add omp_init_allocator_,
	omp_destroy_allocator_, omp_set_default_allocator_ and
	omp_get_default_allocator_.
	* omp_lib.f90.in: Add allocator traits parameters, declare
	allocator routines and add related kind parameters.
	* omp_lib.h.in: Likewise.
	* testsuite/libgomp.c-c++-common/alloc-2.c: Fix sizeof.
	* testsuite/libgomp.fortran/alloc-1.F90: New test.
	* testsuite/libgomp.fortran/alloc-2.F90: New test.
	* testsuite/libgomp.fortran/alloc-3.F: New test.
	* testsuite/libgomp.fortran/alloc-4.f90: New test.
	* testsuite/libgomp.fortran/alloc-5.f90: New test.
2020-07-15 08:33:20 +02:00

24 lines
751 B
Fortran

! { dg-set-target-env-var OMP_ALLOCATOR "omp_cgroup_mem_alloc" }
! { dg-set-target-env-var OMP_DISPLAY_ENV "true" }
program main
use omp_lib
implicit none (external, type)
character(len=255) :: mem_env
type (omp_alloctrait) :: traits(3)
integer (omp_allocator_handle_kind) :: a
call get_environment_variable ("OMP_ALLOCATOR", mem_env)
if (mem_env == "omp_cgroup_mem_alloc") then
if (omp_get_default_allocator () /= omp_cgroup_mem_alloc) stop 1
!$omp parallel num_threads (2)
if (omp_get_default_allocator () /= omp_cgroup_mem_alloc) stop 2
!$omp parallel num_threads (2)
if (omp_get_default_allocator () /= omp_cgroup_mem_alloc) stop 3
!$omp end parallel
!$omp end parallel
end if
end program