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

Stack overflow with private row type #4580

Closed
vicuna opened this issue Jul 17, 2008 · 3 comments
Closed

Stack overflow with private row type #4580

vicuna opened this issue Jul 17, 2008 · 3 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 17, 2008

Original bug ID: 4580
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @garrigue on 2010-04-27T07:17:15Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.10.2
Fixed in version: 3.11+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #4623

Bug description

The following code causes OCaml (e.g. ocamlc or ocamlopt) to fail with

Fatal error: exception Stack_overflow

type 'a s = 'a

module M : sig
type 'a t = private 'a s
constraint 'a = [< A] end = struct type 'a t = 'a s constraint 'a = [< A]
end

@vicuna
Copy link
Author

vicuna commented Aug 1, 2008

Comment author: @xavierleroy

With CVS trunk, this definition is accepted at toplevel, but causes the following problem if put in .ml without .mli and compiled with ocamlc:

File "foo.ml", line 1, characters 0-1:
Error: The implementation foo.ml
does not match the interface (inferred signature):
Modules do not match:
sig type 'a t = 'a M.t constraint 'a = [< A ] end is not included in sig type 'a t = private 'a s constraint 'a = [< A ] end
Type declarations do not match:
type 'a t = 'a M.t constraint 'a = [< A ] is not included in type 'a t = private 'a s constraint 'a = [< A ]

@vicuna
Copy link
Author

vicuna commented Dec 12, 2008

Comment author: @garrigue

The second problem (reported by Xavier) is similar to PR4623, and was fixed for 3.11 in includecore.ml. (Looks like I missed the 1st report with my holidays..)

The first bug is specific to 3.10 (doesn't occur in 3.11).
With the CVS version it no longer causes a stack overflow... just a non-terminating computation. Should look into it.
Note that it is fundamentally different: it is a private row in 3.10, but a private abbreviation in 3.11. While the 3.11 semantics makes sense (use a private abbreviation to hide the representation of t), the 3.10 semantics does not make sense in this example: it should just be equivalent to writing "type 'a t = private [< `A]", which works ok. So this is really only about making the compiler terminate even on meaningless code.

@vicuna
Copy link
Author

vicuna commented Apr 27, 2010

Comment author: @garrigue

I was only keeping this one around because of 3.10, but since it went out of support a while ago, it seems ok to close this issue.

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

No branches or pull requests

2 participants