Bugs in the Racket Bytecode Versifier (as of 6.7)

50 views
Skip to first unread message

Leif Andersen

unread,
Jan 18, 2017, 3:58:57 PM1/18/17
to Racket-Users List, racket-dev
Hey all,

I noticed that the following program fails to run, but only after its been compiled (on 6.7, 6.6 and earlier don't seem to have this issue):

https://gist.github.com/LeifAndersen/dfad9a8f55ef671e4f3aa41b321ef7bf

#lang racket/base ;; ill-formed.rkt
(define ill
  (let ((base (string-append "a")))
    (λ () base)))
(ill)

To get the error, run:

$ raco make ill-formed.rkt
$ racket ill-formed.rkt
?? 0
compiled/ill-formed_rkt.zo::369: read (compiled): ill-formed code [../../../racket/gc2/../src/validate.c:1426]
  context...:
   standard-module-name-resolver

This error doesn't seem to happen if `string-append` is replaced with various other functions that create strings (or just string literals), and it seems to go away if the function is inlined.

I'm not entirely sure what's causing this bug yet, but it appears to either be a bug in the versifier, or a new optimization. Has anyone else seen something like this recently? (If not I'll update the list once I get a sense as to what is going on.)

~Leif Andersen

Matthew Flatt

unread,
Jan 18, 2017, 5:39:28 PM1/18/17
to Leif Andersen, Racket-Users List, racket-dev
The bug is a mismatch between the optimizer and validator, where the
optimizer can see that `string-append` is applied to a string and will
definitely succeed, while the validator can't infer that behavior. The
fact by itself isn't the problem, but it allows a further inference in
the optimizer that's relevant to the validator.

The optimizer should use a specific flag internally at a specific point
to keep it consistent with the validator. I'll push that repair after
testing.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages