From a92ba10a9deb3772e995481f8caa7b552691d6cf Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Fri, 8 Oct 2021 14:40:39 +0200 Subject: [PATCH] Add testcase for static array access. --- CMakeLists.txt | 1 + src/tests/unit/send-get/CMakeLists.txt | 1 + src/tests/unit/send-get/get_static_array.f90 | 23 ++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/tests/unit/send-get/get_static_array.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b4f6c872..7e11a420a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -795,6 +795,7 @@ if(opencoarrays_aware_compiler) add_caf_test(get_with_offset_1d 2 get_with_offset_1d) add_caf_test(whole_get_array 2 whole_get_array) add_caf_test(strided_get 2 strided_get) + add_caf_test(get_static_array 2 get_static_array) # Pure send tests add_caf_test(send_array 2 send_array) diff --git a/src/tests/unit/send-get/CMakeLists.txt b/src/tests/unit/send-get/CMakeLists.txt index 8de3ab279..7dff2b4da 100644 --- a/src/tests/unit/send-get/CMakeLists.txt +++ b/src/tests/unit/send-get/CMakeLists.txt @@ -13,6 +13,7 @@ caf_compile_executable(strided_get strided_get.f90) caf_compile_executable(get_with_vector_index get_with_vector_index.f90) ## Inquiry functions (these are gets that could be optimized in the future to communicate only the descriptors) caf_compile_executable(alloc_comp_multidim_shape alloc_comp_multidim_shape.F90) +caf_compile_executable(get_static_array get_static_array.f90) ## Pure send() tests caf_compile_executable(send_array send_array_test.f90) diff --git a/src/tests/unit/send-get/get_static_array.f90 b/src/tests/unit/send-get/get_static_array.f90 new file mode 100644 index 000000000..5721b3d01 --- /dev/null +++ b/src/tests/unit/send-get/get_static_array.f90 @@ -0,0 +1,23 @@ +program get_static_array + type :: container + integer, allocatable :: stuff(:) + end type + + type(container) :: co_containers(10)[*] + + if (this_image() == 1) then + allocate(co_containers(2)%stuff(4)) + co_containers(2)%stuff = [1,2,3,4] + end if + + sync all + + if (this_image() == 2) then + if (any(co_containers(2)[1]%stuff /= [1,2,3,4])) then + error stop "Test failed." + else + print *, "Test passed." + end if + end if +end program +