From 133acb113ba9d64dfb7964814e493eb7feebca2c Mon Sep 17 00:00:00 2001
From: "raphael.bach" <raphael.bach@etu.hesge.ch>
Date: Wed, 22 Jun 2022 05:32:04 +0200
Subject: [PATCH] Add static assertions on `FMPI_DIM_MAX` in `fmpi_futhark.c`

---
 src/fmpi_futhark.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/fmpi_futhark.c b/src/fmpi_futhark.c
index 4161a75..22760b4 100644
--- a/src/fmpi_futhark.c
+++ b/src/fmpi_futhark.c
@@ -157,6 +157,7 @@ void * fmpi_futhark_new_##D##d_##T( \
     const struct fmpi_futhark_ctx * const ctx, const void * const array, \
     const size_t x, const size_t y, const size_t z \
 ){ \
+    _Static_assert((D) <= FMPI_DIM_MAX, ""); \
     assert(ctx != NULL); \
     assert(array != NULL); \
     struct futhark_##T##_##D##d * data = FMPI_FUTHARK_NEW_##D(T, ctx->ctx, array, x, y, z); \
@@ -169,6 +170,7 @@ void * fmpi_futhark_new_##D##d_##T( \
 void fmpi_futhark_free_##D##d_##T( \
     const struct fmpi_futhark_ctx * const ctx, void * const array \
 ){ \
+    _Static_assert((D) <= FMPI_DIM_MAX, ""); \
     assert(ctx != NULL); \
     assert(array != NULL); \
     fmpi_futhark_sync(ctx);\
-- 
GitLab