Skip to content

Commit

Permalink
Fix bug in test for caf_allocate related to uninitialized arrays.
Browse files Browse the repository at this point in the history
Assign appropriate values to `lcobounds` and `ucobounds` before
passing to `prif_allocate`.
  • Loading branch information
ktras committed Dec 14, 2023
1 parent 36b5e08 commit 0efbecc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/caf_allocate_test.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module caf_allocate_test
use prif, only : prif_allocate, prif_coarray_handle
use prif, only : prif_allocate, prif_coarray_handle, prif_num_images
use veggies, only: result_t, test_item_t, assert_that, assert_equals, describe, it
use iso_c_binding, only: c_ptr, c_int, c_intmax_t, c_size_t, c_funptr, c_null_funptr, c_f_pointer, c_null_ptr

Expand Down Expand Up @@ -28,11 +28,15 @@ function check_allocate_integer_scalar_coarray_with_corank1() result(result_)
integer(kind=c_intmax_t), dimension(1) :: lcobounds, ucobounds
integer(kind=c_intmax_t), dimension(0), parameter :: lbounds = [integer(kind=c_intmax_t) ::]
integer(kind=c_intmax_t), dimension(0), parameter :: ubounds = [integer(kind=c_intmax_t) ::]
integer :: dummy_element
integer :: dummy_element, num_imgs
type(prif_coarray_handle) :: coarray_handle
type(c_ptr) :: allocated_memory
integer, pointer :: local_slice

call prif_num_images(image_count=num_imgs)
lcobounds(1) = 1
ucobounds(1) = num_imgs

allocated_memory = c_null_ptr
local_slice => null()
result_ = assert_that(.not.associated(local_slice))
Expand Down

0 comments on commit 0efbecc

Please sign in to comment.