[racket] I think I found a bug in the JITC

From: Erik Dominikus (erik.dominikus71 at gmail.com)
Date: Mon Jan 30 09:21:57 EST 2012

Source code for reproducing attached.
'racket --version' shows 5.2.
I built from source.

The expected result is a list, but Racket gave this error message
instead:


internal error: flonum position not found

 === context ===
/kage/racket-5.2/collects/racket/private/stream-cons.rkt:42:0:
stream-force
/kage/racket-5.2/collects/racket/private/stream-cons.rkt:79:0:
stream-null?
/kage/racket-5.2/collects/racket/private/for.rkt:388:2:
unsafe-stream-not-empty?
/home/erik/scheme/bug.rkt:12:0: for-loop
/home/erik/scheme/bug.rkt: [running body]


and upon seeing that message for the first time, I was dumbstruck. I was
quite sure that I made no transgression since I was using the library
normally as documented, so I took 'internal error' as a bug. After
tracing the error message to line 656 of the file
src/racket/src/jitstate.c, I thought the bug is in the JITC. It turns
out that disabling the JITC (racket -j) produces the expected result, so
I'm somewhat more sure that the bug is in the JITC.


In advance, I'd like to thank the people who will fix this bug, if it is
really a bug.

-------------- next part --------------
#lang racket/base

(require
  racket/function
  racket/flonum
  racket/stream)

(define (function->stream f)
  (let s ((t 0.0))
    (stream-cons (f t) (s (fl+ t 1.0)))))

(for/list ((i (in-range 10))
           (x (in-stream (function->stream identity))))
          x)

Posted on the users mailing list.