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

Destructive module substitution allows module aliases to extended paths #6376

vicuna opened this Issue Apr 20, 2014 · 1 comment


None yet
2 participants
Copy link

commented Apr 20, 2014

Original bug ID: 6376
Reporter: @lpw25
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:26:39Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: typing

Bug description

Destructive module substitution does not check whether the module being replaced is used in an alias, which means you can create aliases to extended paths. Using the usual trick to convert module types into modules, we obtain a segmentation fault:

        OCaml version 4.02.0+dev4-2014-04-03

# module type Alias = sig module N : sig end module M = N end;;
module type Alias = sig module N : sig  end module M = N end
# module F (X : sig  end) = struct type t end;;
module F : functor (X : sig  end) -> sig type t end
# module type A = Alias with module N := F(List);;
module type A = sig module M = F(List) end
# module rec Bad : A = Bad;;
Segmentation fault

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 21, 2014

Comment author: @garrigue

Well spotted!
I completely overlooked the fact one could corrupt a module alias this way.

Fixed in trunk, revision 14650, in Includemod.try_modtypes.
Just cause an error in that case (a specialized signature should refine
the original one, and this is impossible here).

@vicuna vicuna closed this Dec 11, 2015

@vicuna vicuna added the typing label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

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.