From d1fe6a6e3e26df403f650ae821aa0adbd3df491d Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Oct 2018 16:54:55 -0600 Subject: [PATCH] repair allocation bug in delimited continuations The repair is more precisely a repait to xform, which incorrectly parsed a C function definition that starts "struct" as a struct declaration. (The function starts "struct" because the return type is "struct Scheme_Overflow_Jmp *".) Since the function wasn't recognized, xform didn't convert it to cooperate with the garbage collector. Closes #2341 --- racket/collects/compiler/private/xform.rkt | 3 ++- racket/src/racket/src/setjmpup.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/racket/collects/compiler/private/xform.rkt b/racket/collects/compiler/private/xform.rkt index 00b76148be..10be0b53dc 100644 --- a/racket/collects/compiler/private/xform.rkt +++ b/racket/collects/compiler/private/xform.rkt @@ -1808,7 +1808,8 @@ (define (struct-decl? e) (and (memq (tok-n (car e)) '(struct enum)) - (ormap braces? (cdr e)))) + (ormap braces? (cdr e)) + (not (function? e)))) (define (class-decl? e) (memq (tok-n (car e)) '(class))) diff --git a/racket/src/racket/src/setjmpup.c b/racket/src/racket/src/setjmpup.c index 421c309d6a..66b66728fb 100644 --- a/racket/src/racket/src/setjmpup.c +++ b/racket/src/racket/src/setjmpup.c @@ -590,7 +590,7 @@ struct Scheme_Overflow_Jmp *scheme_prune_jmpup(struct Scheme_Overflow_Jmp *jmp, base = (char *)stack_boundary; # else delta = 0; - new_size = (intptr_t)stack_boundary - (intptr_t)jmp->cont.stack_from; + new_size = (intptr_t)stack_boundary XFORM_OK_MINUS (intptr_t)jmp->cont.stack_from; base = jmp->cont.stack_from; # endif