From 0a2d0574bba6d7e05523d0a6fe8283b798e26584 Mon Sep 17 00:00:00 2001 From: Roland Haas Date: Fri, 6 Dec 2024 09:42:01 -0600 Subject: [PATCH] CarpetX: avoid varsize array --- CarpetX/src/io_openpmd.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CarpetX/src/io_openpmd.cxx b/CarpetX/src/io_openpmd.cxx index 04f91c545..fdfcd0810 100644 --- a/CarpetX/src/io_openpmd.cxx +++ b/CarpetX/src/io_openpmd.cxx @@ -1206,8 +1206,8 @@ void carpetx_openpmd_t::InputOpenPMD(const cGH *const cctkGH, constexpr std::uint64_t ipoison = 0xfff8000000000000ULL + 0xdeadbeef; #endif - char poison[CCTK_VarTypeSize(cgroup.vartype)]; - std::memcpy(&poison, &ipoison, sizeof(poison)); + std::vector poison(CCTK_VarTypeSize(cgroup.vartype)); + std::memcpy(poison.data(), &ipoison, poison.size()); for (int k = extbox.lo[2]; k < extbox.hi[2]; ++k) { for (int j = extbox.lo[1]; j < extbox.hi[1]; ++j) { for (int i = extbox.lo[0]; i < extbox.hi[0]; ++i) { @@ -1216,7 +1216,7 @@ void carpetx_openpmd_t::InputOpenPMD(const cGH *const cctkGH, memcpy(cactus_ptr->data_at(cactus_di * i + cactus_dj * j + cactus_dk * k), - poison, sizeof(poison)); + poison.data(), poison.size()); } } }