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

GADT constructors can be re-exposed with an incompatible type => segfault #7378

Closed
vicuna opened this issue Sep 28, 2016 · 1 comment
Closed
Assignees
Labels
bug high-priority typing typing-GADTS GADT typing and exhaustiveness bugs
Milestone

Comments

@vicuna
Copy link

vicuna commented Sep 28, 2016

Original bug ID: 7378
Reporter: @alainfrisch
Assigned to: @garrigue
Status: resolved (set by @garrigue on 2016-09-28T10:42:12Z)
Resolution: fixed
Priority: high
Severity: major
Target version: 4.04.0 +dev / +beta1 / +beta2
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: typing
Child of: #5998

Bug description

module X = struct
  type t =
    | A : 'a * 'b * ('a -> unit) -> t
end

module Y = struct
  type t = X.t =
    | A : 'a * 'b * ('b -> unit) -> t
end


let () =
  match Y.A (1, "", print_string) with
  | X.A (x, y, f) -> f x

The definition for Y.t should be rejected, but it's not, leading to a segfault further down.

@vicuna
Copy link
Author

vicuna commented Sep 28, 2016

Comment author: @garrigue

Fixed in 4.04 by commit 10301ac

In presence of existential type variables in the definition, it is essential that Ctype.equal be called on all argument types simultaneously.
I kind of recall fixing that once before, so I left a comment about it in includecore.ml.

@vicuna vicuna closed this as completed Sep 28, 2016
@vicuna vicuna added this to the 4.04.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
@Octachron Octachron added the typing-GADTS GADT typing and exhaustiveness bugs label May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug high-priority typing typing-GADTS GADT typing and exhaustiveness bugs
Projects
None yet
Development

No branches or pull requests

3 participants