[plt-scheme] Why this crash DrScheme ?

From: Ryan Culpepper (ryan_sml at yahoo.com)
Date: Wed Jun 21 00:46:57 EDT 2006

For what it's worth, the problem has nothing to do with macros. The
following also causes the error:

  (begin (define (f) (set! val (add1 val))) (f))

It seems to be a bug in the JIT compiler; turning JIT compilation off
avoids the crash.

Ryan

--- Jaime Vargas <jev at mac.com> wrote:

> I was just playing with macros trying to emulate other languages  
> grammar, and I manage to crash DrScheme v350 consistently.  Here is
>  
> the code:
> 
> (define-syntax loop
>    (syntax-rules ()
>      ((loop n expr1 expr2 ...)
>       (let iterate ([i 0])
>         (set! i (add1 i))
>         (if (<= i n)
>             (begin
>               expr1 expr2 ...
>               (iterate i)))))))
> 
> (define-syntax ++
>    (syntax-rules ()
>      ((++ val) (begin
>                  (set! val (+ val 1))
>                  val))))
> 
> (define i 0)
> (loop 10
>        (printf "~a~n" (++ val)))
> 
> I know the error is that val is not defined, however DrScheme
> doesn't  
> signal this instead it tries to execute and then it crashes. Should
>  
> this behavior happen?
> 
> -- Jaime
> 
> > _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 



Posted on the users mailing list.