diff --git a/rts/Threads.c b/rts/Threads.c
index 44dcf5170e45fb1d870b160f57166c5ebbfee903..031ac21247cc00434bdfd957a7685b607997b77d 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -1013,10 +1013,10 @@ printGlobalThreads(void)
   for (uint32_t g = 0; g < RtsFlags.GcFlags.generations; g++) {
     debugBelch("\ngen %d\n", g);
     for (StgTSO *t = generations[g].threads; t != END_TSO_QUEUE; t = t->global_link) {
-      debugBelch("thread %p (id=%lu)\n", t, t->id);
+      debugBelch("thread %p (id=%lu)\n", t, (unsigned long)t->id);
     }
     for (StgTSO *t = generations[g].old_threads; t != END_TSO_QUEUE; t = t->global_link) {
-      debugBelch("thread %p (id=%lu) (old)\n", t, t->id);
+      debugBelch("thread %p (id=%lu) (old)\n", t, (unsigned long)t->id);
     }
   }
 }