[racket-dev] Odd bug with begin0 and call-with-values

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Nov 5 18:32:35 EST 2012

Thanks for the example. Here's a small variant:

 #lang racket/base
 (call-with-values
     (lambda () (begin0
                 (values 1 2 3)
                 (+ 1 (random 1))))
   list)

The bug wasn't new. It was an old, amazing-that-we-never-hit-it-before
bug.

Fix pushed.

At Mon, 5 Nov 2012 15:25:57 -0700, Matthew Flatt wrote:
> This looks like the sort of thing that I could have broken over the
> weekend. I'm not able to construct an example from just this
> information, so even a large amount of code may be useful.
> 
> At Mon, 5 Nov 2012 16:46:29 -0500 (EST), "J. Ian Johnson" wrote:
> > Code that used to work is now failing with a pull of the master today. I 
> can't 
> > reproduce it in small amounts of code, which makes me think it's another 
> weird 
> > JIT problem.
> > 
> > I have a harness of this kind:
> > (define (print-values . vs) (for ([v vs]) (display v) (newline)))
> >  (with-limits 3600 4096 (call-with-values (lambda () (begin0 (time (analysis 
> > program)) (dump-memory-stats))) print-values)
> > 
> > The dump is not reached. Instead, (analysis program) finishes with the 
> expected 
> > number of values, and once those values pass out of the expression, I get an 
> > error of the following kind:
> > exn:fail:contract:arity
> > 
> > It expects 1 value instead of the arbitrary amount it should expect for the 
> > print-values.
> > I can supply a large amount of code that exercises this behavior, but if this 
> > is enough to go off, great.
> > Thanks,
> > -Ian
> > _________________________
> >   Racket Developers list:
> >   http://lists.racket-lang.org/dev
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.