[plt-scheme] Why this crash DrScheme ?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jun 23 14:12:45 EDT 2006

This is now fixed in SVN. The bug affects accessing a top-level
variable (not in a module) that is not yet defined, but where a `set!'
to the variable has been compiled.

Thanks,
Matthew

At Tue, 20 Jun 2006 21:46:57 -0700 (PDT), Ryan Culpepper wrote:
> 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



Posted on the users mailing list.