Skip to content

Commit

Permalink
Merge pull request #1087 from aprokop/fix_gcc
Browse files Browse the repository at this point in the history
Fix test for GCC-13
  • Loading branch information
aprokop authored May 11, 2024
2 parents d2f80a5 + 476c239 commit d0d1fc5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/tstDetailsKokkosExtUninitializedMemoryAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ struct NoDefaultConstructor
KOKKOS_FUNCTION NoDefaultConstructor(int x)
: value(x)
{}
KOKKOS_FUNCTION ~NoDefaultConstructor() { value = -1; }
KOKKOS_FUNCTION ~NoDefaultConstructor()
{
// Make sure compiler does not optimize out the write
*((int volatile *)&value) = -1;
}
};

BOOST_AUTO_TEST_CASE_TEMPLATE(construct_destroy_at, DeviceType,
Expand All @@ -55,7 +59,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(construct_destroy_at, DeviceType,
Kokkos::parallel_for(
"Test::destroy", Kokkos::RangePolicy<ExecutionSpace>(exec, 0, n),
KOKKOS_LAMBDA(int i) { destroy_at(&view(i)); });
Kokkos::deep_copy(exec, view_host, view);
Kokkos::deep_copy(view_host, view);
BOOST_TEST(view_host(0).value == -1);
BOOST_TEST(view_host(1).value == -1);
}

0 comments on commit d0d1fc5

Please sign in to comment.