From b8b8e5410938d88b6a4ea608257aa787183d9590 Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Fri, 3 Jul 2020 15:44:05 +0100
Subject: [PATCH] Squash some GCC warnings about unsigned/signed comparisons

---
 error.h           | 1 +
 mpiuse.c          | 2 +-
 swiftmpistepsim.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/error.h b/error.h
index 26b99fb..cd24a4d 100644
--- a/error.h
+++ b/error.h
@@ -18,6 +18,7 @@ extern int myrank;
   ({                                                                     \
     printf("[%04i] %s %s: " s "\n", myrank, clocks_get_timesincestart(), \
            __FUNCTION__, ##__VA_ARGS__);                                 \
+    fflush(stdout);                                                      \
   })
 
 /* Print MPI error string. */
diff --git a/mpiuse.c b/mpiuse.c
index 6bd7b31..4748edd 100644
--- a/mpiuse.c
+++ b/mpiuse.c
@@ -254,6 +254,6 @@ int mpiuse_nr_ranks(void) { return mpiuse_max_rank + 1; }
  */
 struct mpiuse_log_entry *mpiuse_get_log(int ind) {
 
-  if (ind < mpiuse_log_count && ind >= 0) return &mpiuse_log[ind];
+  if ((size_t)ind < mpiuse_log_count && ind >= 0) return &mpiuse_log[ind];
   return NULL;
 }
diff --git a/swiftmpistepsim.c b/swiftmpistepsim.c
index 5722398..04787bf 100644
--- a/swiftmpistepsim.c
+++ b/swiftmpistepsim.c
@@ -378,7 +378,7 @@ static void pick_logs(void) {
       nlogs, sizeof(struct mpiuse_log_entry *));
   nr_recvs = 0;
 
-  for (int k = 0; k < nlogs; k++) {
+  for (size_t k = 0; k < nlogs; k++) {
     struct mpiuse_log_entry *log = mpiuse_get_log(k);
     if (log->rank == myrank && log->activation) {
       if (log->type == task_type_send || log->type == task_type_recv) {
-- 
GitLab