Fix a regression in sb-safepoint.
authorStas Boukarev <stassats@gmail.com>
Tue, 10 Sep 2013 17:40:42 +0000 (21:40 +0400)
committerStas Boukarev <stassats@gmail.com>
Tue, 10 Sep 2013 17:40:42 +0000 (21:40 +0400)
WITH_GC_AT_SAFEPOINTS_ONLY is actually a fancy macro, which wraps the
form following it in some code. In a recent change that wasn't
accounted for and resulted in bad consequences. Add {} around the code
after WITH_GC_AT_SAFEPOINTS_ONLY.
Reported by Jan Moringen.

src/runtime/interrupt.c

index 7497d2b..bdfaef2 100644 (file)
@@ -1085,22 +1085,24 @@ interrupt_handle_now(int signal, siginfo_t *info, os_context_t *context)
 
         lispobj info_sap, context_sap;
 
-#ifdef LISP_FEATURE_SB_SAFEPOINT
-        WITH_GC_AT_SAFEPOINTS_ONLY()
-#else
+#ifndef LISP_FEATURE_SB_SAFEPOINT
         /* Leave deferrable signals blocked, the handler itself will
          * allow signals again when it sees fit. */
         unblock_gc_signals(0, 0);
+#else
+        WITH_GC_AT_SAFEPOINTS_ONLY()
 #endif
-        context_sap = alloc_sap(context);
-        info_sap = alloc_sap(info);
+        { // the block is needed for WITH_GC_AT_SAFEPOINTS_ONLY() to work
+            context_sap = alloc_sap(context);
+            info_sap = alloc_sap(info);
 
-        FSHOW_SIGNAL((stderr,"/calling Lisp-level handler\n"));
+            FSHOW_SIGNAL((stderr,"/calling Lisp-level handler\n"));
 
-        funcall3(handler.lisp,
-                 make_fixnum(signal),
-                 info_sap,
-                 context_sap);
+            funcall3(handler.lisp,
+                     make_fixnum(signal),
+                     info_sap,
+                     context_sap);
+        }
     } else {
         /* This cannot happen in sane circumstances. */