diff --git a/src/runner_doiact.h b/src/runner_doiact.h
index 4bb46e3e04c0c3ca28fa7ab3ad1c9c63629c896f..5812b9641dbb371eff74c1b9a1c4c68b8f1d3f79 100644
--- a/src/runner_doiact.h
+++ b/src/runner_doiact.h
@@ -587,7 +587,9 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
 void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
                    struct part *restrict parts, int *restrict ind, int count) {
 
+#ifdef SWIFT_DEBUG_CHECKS
   const struct engine *e = r->e;
+#endif
 
   TIMER_TIC;