diff --git a/include/flamegpu/simulation/detail/AbstractSimRunner.h b/include/flamegpu/simulation/detail/AbstractSimRunner.h index 60c4dbc5e..2ae9d4bda 100644 --- a/include/flamegpu/simulation/detail/AbstractSimRunner.h +++ b/include/flamegpu/simulation/detail/AbstractSimRunner.h @@ -47,10 +47,11 @@ class AbstractSimRunner { ErrorDetail t; constexpr int count = 4; constexpr int array_of_blocklengths[count] = {1, 1, 1, sizeof(ErrorDetail::exception_string)}; - constexpr MPI_Aint array_of_displacements[count] = { reinterpret_cast(&t.run_id - &t), - reinterpret_cast(&t.device_id - &t), - reinterpret_cast(&t.runner_id - &t), - reinterpret_cast(&t.exception_string - &t) }; + constexpr void* t_ptr = reinterpret_cast(&t); + constexpr MPI_Aint array_of_displacements[count] = { reinterpret_cast(&t.run_id) - t_ptr), + reinterpret_cast(&t.device_id) - t_ptr), + reinterpret_cast(&t.runner_id) - t_ptr), + reinterpret_cast(&t.exception_string) - t_ptr }; constexpr MPI_Datatype array_of_types[count] = {MPI_UNSIGNED, MPI_UNSIGNED, MPI_UNSIGNED, MPI_CHAR}; MPI_Type_create_struct(count, array_of_blocklengths, array_of_displacements, array_of_types, &rtn); }