Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: exception Failure("File \"lam_dce.ml\", ...) #1667

Closed
jmid opened this issue Jun 1, 2017 · 1 comment
Closed

Fatal error: exception Failure("File \"lam_dce.ml\", ...) #1667

jmid opened this issue Jun 1, 2017 · 1 comment

Comments

@jmid
Copy link

jmid commented Jun 1, 2017

Consider the following program:

let i = 
  (let e = (=) (let o = false in (fun z -> (let m = () in fun n -> 0) (fun q -> fun y -> o)) o) 0 in 0)
in print_int i

I admit it is a bit contrived, but when I attempt to cut it further down, other optimizations kick in and the issue disappears.

Anyway, with BuckleScript 1.7.4 (Using OCaml4.02.3+BS ) this program actually crashes the compiler:

$ ./node_modules/bs-platform/bin/bsc.exe issues-bs/failure2.ml
File "issues-bs/failure2.ml", line 2, characters 7-8:
Warning 26: unused variable e.
File "issues-bs/failure2.ml", line 2, characters 48-49:
Warning 26: unused variable m.
Fatal error: exception Failure("File \"lam_dce.ml\", line 48, characters 40-47o/1010 not found")
$

although it is vanilla OCaml:

$ ocamlc -o issues-bs/failure2.byte issues-bs/failure2.ml
File "issues-bs/failure2.ml", line 2, characters 7-8:
Warning 26: unused variable e.
File "issues-bs/failure2.ml", line 2, characters 48-49:
Warning 26: unused variable m.
$ ./issues-bs/failure2.byte 
0$ 

It seems related to using a variable o bound in an outer scope.

@bobzhang
Copy link
Member

bobzhang commented Jun 1, 2017

hi @jmid landed a fix, really appreciate that such a small example which is much easier to debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants