-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"module type of" + recursive modules + functors segfault in bytecode interpreter (4.07 regression) #7787
Comments
Comment author: @mshinwell The lambda code (for the version without the attribute) is: (setglobal Test! |
Comment author: @mshinwell trefis confirms this segfaults with ocamlopt too. |
Comment author: @trefis I pushed the rebased patch here: trefis@5f1036f (I'll let Leo do a proper rebase) For the record, I'm attaching the -dlambda output ocamlc without 1652 nor 1610 (that's remove-aliases.lambda), with only 1652 (broken-dont-remove-aliases) and with both (fixed-dont-remove-aliases). |
Comment author: @mshinwell Let's add this example to the testsuite in #1610 too... |
Comment author: @trefis Spoke too quickly, I had tested the rebase of gpr1610 with the [@remove_aliases] uncommented. If I remove it the example is still broken; gpr1610 actually has no impact. Sorry. |
Comment author: @trefis I think I've got a fix for this, I'll create a GPR shortly. |
Original bug ID: 7787
Reporter: @mshinwell
Assigned to: @trefis
Status: resolved (set by @trefis on 2018-05-01T08:47:36Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.07.0+dev/beta2/rc1/rc2
Target version: 4.07.0+dev/beta2/rc1/rc2
Category: middle end (typedtree to clambda)
Monitored by: @hhugo
Bug description
In 4.07 the following code causes a segfault in the bytecode interpreter, trying to read a field of the unit value, unless the "remove_aliases" attribute is added. This appears to work with 4.06.
Thanks to hheuzard and xclerc for help investigating this.
module O (T : sig
module N : sig
val foo : int -> int
end
end) = struct
open T
let go () =
N.foo 42 (* finding N (from T) goes wrong *)
end
module T = struct
module N = struct
let foo x = x + 3
end
end;;
(* Incidentally, M isn't used in T2, but it doesn't seem to fail if
it's just "module M" and "module T2" separately )
module rec M : sig
val go : unit -> int
end = O (T2)
and T2 : sig
include module type of struct include T end ( [@remove_aliases] *)
end = struct
include T
end;;
let _ = ignore (M.go ())
Steps to reproduce
Compile the above program with ocamlc and run it.
File attachments
The text was updated successfully, but these errors were encountered: