Index: third-party/chicken/runtime.c
===================================================================
--- third-party/chicken/runtime.c	(revision 145132)
+++ third-party/chicken/runtime.c	(revision 145133)
@@ -1488,6 +1488,10 @@
 
 #if C_STACK_GROWS_DOWNWARD
   C_stack_hard_limit = (C_word *)((C_byte *)C_stack_pointer - stack_size);
+# ifdef __MINGW64__
+    /* For some reason, on MinGW64, the stack is about 4 to 5 KB smaller than it should be. */
+    C_stack_hard_limit += 8192;
+# endif
 #else
   C_stack_hard_limit = (C_word *)((C_byte *)C_stack_pointer + stack_size);
 #endif
Index: third-party/chicken/chicken.h
===================================================================
--- third-party/chicken/chicken.h	(revision 145132)
+++ third-party/chicken/chicken.h	(revision 145133)
@@ -964,8 +964,16 @@
 # ifdef HAVE_SIGPROCMASK
 #  define C_sigprocmask             sigprocmask
 # endif
-# define C_setjmp                   setjmp
-# define C_longjmp                  longjmp
+
+# if defined(__MINGW64__) && defined(__GNUC__)
+/* on 64-bit MinGW, setjmp and longjmp are known to be buggy; use GCC's builtin ones instead. */
+#  define C_setjmp                   __builtin_setjmp
+#  define C_longjmp                  __builtin_longjmp
+# else
+#  define C_setjmp                   setjmp
+#  define C_longjmp                  longjmp
+# endif
+
 # define C_alloca                   alloca
 # define C_strerror                 strerror
 # define C_isalpha                  isalpha
