diff --git a/src/m_misc.c b/src/m_misc.c
index 041899a3b77060ac6868494a11f3a25a39748376..69542dc9a2c197e3a44d0bfeab3d16e4e7145709 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -56,7 +56,9 @@ typedef off_t off64_t;
 #endif
 #endif
 
-#if defined (_WIN32)
+#if defined(__MINGW32__) &&(__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)
+#define PRIdS "u"
+#elif defined (_WIN32) 
 #define PRIdS "Iu"
 #elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3)
 #define PRIdS "u"