Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004580OCamlOCaml generalpublic2008-07-17 12:032010-04-27 09:17
Reporteryallop 
Assigned Togarrigue 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
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]
end
TagsNo tags attached.
Attached Files

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

-  Notes
(0004550)
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 "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 ]
(0004797)
garrigue (manager)
2008-12-12 11:05

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.
(0005386)
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker