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

Inclusion of packs failing to run module initializers #6563

Closed
vicuna opened this issue Sep 17, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Sep 17, 2014

Original bug ID: 6563
Reporter: @mshinwell
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:34:44Z)
Resolution: fixed
Priority: high
Severity: minor
Version: 4.02.1+dev
Fixed in version: 4.02.1+dev
Category: typing
Monitored by: @diml @yakobowski

Bug description

I'm not completely sure this is a bug, but I suspect it is.

$ cat a.ml
let () = Printf.printf "a is loaded\n%!"
$ cat b.ml
include (Pack : sig end)
$ ocamlopt -c -for-pack Pack a.ml
$ ocamlopt -pack a.cmx -o pack.cmx
$ ocamlopt -a pack.cmx -o pack.cmxa
$ ocamlopt -c b.ml
$ ocamlopt pack.cmxa b.cmx
$ ./a.out

When run on 4.01, the printf statement executes.
With 4.02, it does not.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 17, 2014

Comment author: @garrigue

Interesting.
It doesn't seem to be related to module aliases, but may be the consequence of some extra simplifications on lambda-code involving modules.
I'm still confused at why your b.ml and the following c.ml end up being compiled differently:
include (A : sig end)

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 17, 2014

Comment author: @garrigue

Fix in 4.02 at revision 15238.

Just reverting a StrictOpt to Strict solved the problem, with
no other side-effects (since there is a coercion, this is not
a module alias).
Actually this is not related to pack: you could obtain
the same result by coercing a non-empty signature to
an empty one:

$ cat a.ml
let () = Printf.printf "a is loaded\n%!"
let x = 3
$ cat c.ml
include (A : sig end)
$ ocamlopt -c a.ml
$ ocamlopt -c c.ml
$ ocamlopt c.cmx -o c.opt # !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.