Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004580OCaml~DO NOT USE (was: OCaml general)public2008-07-17 12:032010-04-27 09:17
Assigned Togarrigue 
PlatformOSOS Version
Product Version3.10.2 
Target VersionFixed in Version3.11+dev 
Summary0004580: Stack overflow with private row type
DescriptionThe 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]
TagsNo tags attached.
Attached Files

- Relationships
related to 0004623closedgarrigue Private constraints accepted by toplevel but not by compiler 

-  Notes
xleroy (administrator)
2008-08-01 11:21

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 "", line 1, characters 0-1:
Error: The implementation
       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 ]
garrigue (manager)
2008-12-12 11:05

The second problem (reported by Xavier) is similar to PR4623, and was fixed for 3.11 in (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.
garrigue (manager)
2010-04-27 09:17

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.

- Issue History
Date Modified Username Field Change
2008-07-17 12:03 yallop New Issue
2008-08-01 11:21 xleroy Note Added: 0004550
2008-08-01 11:21 xleroy Assigned To => garrigue
2008-08-01 11:21 xleroy Status new => assigned
2008-12-12 11:05 garrigue Note Added: 0004797
2010-04-27 09:16 garrigue Relationship added related to 0004623
2010-04-27 09:17 garrigue Note Added: 0005386
2010-04-27 09:17 garrigue Status assigned => closed
2010-04-27 09:17 garrigue Resolution open => fixed
2010-04-27 09:17 garrigue Fixed in Version => 3.11+dev
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker