| Anonymous | Login | Signup for a new account | 2013-05-19 06:43 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0003984 | OCaml | OCaml general | public | 2006-03-04 16:33 | 2012-09-11 14:47 | ||||||
| Reporter | mwahab | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | tweak | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.09.1 | ||||||||||
| Target Version | 4.01.0+dev | Fixed in Version | |||||||||
| Summary | 0003984: Compiler ignores types in .cmi file [problems with #trace] | ||||||||||
| Description | The OCaml compiler (ocamlc) seems to ignore the function declarations in .cmi files, allowing wrongly typed expressions. This bug was discovered when using #trace where it lead to a segmentation violation. Files attached (in ocamlbug.tar): test.mli, test.ml and script.ml. Compile test.mli then test.ml: ocamlc -c test.mli ocamlc -c test.ml Run the script: ocaml script.ml The compiler should fail on test.ml but doesn't and running the script leads to a segfault. | ||||||||||
| Additional Information | The system used is OCaml version 3.09.1 on Linux-x86. | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0003586) Christophe (reporter) 2006-03-05 09:18 |
This is not a bug of ocamlc. The mli file constraints the types outside of the module, not inside ! In your example, the type of log is val log : 'a -> 'b -> unit inside module test, but outside it is what you wrote in test.mli The only bug is in the directive #trace that follows the public type not the private.... It can be seen with simpler examples : # module T: sig val f : int -> unit val g: 'a -> unit end = struct let f x = ignore x let g x = f x end;; module T : sig val f : int -> unit val g : 'a -> unit end # #trace T.f;; T.f is now traced. # T.g 'a';; T.f <-- 97 T.f --> () - : unit = () Of course, it must not do a seg fault when printing some "impossible value" (so there is something to be fixed (?), even if it does not crach on most example, but if you use string instead of int in the simple example, it crashes because it does not verify that the "string" is well formed... ) I am not sure it must be fixed (it seems using #trace is like using module Obj.... it must be done with careful knowledge) |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2006-03-04 16:33 | mwahab | New Issue | |
| 2006-03-04 16:33 | mwahab | File Added: ocamlbug.tar | |
| 2006-03-05 09:18 | Christophe | Note Added: 0003586 | |
| 2006-03-29 16:23 | doligez | Severity | minor => tweak |
| 2006-03-29 16:23 | doligez | Status | new => acknowledged |
| 2006-03-29 16:23 | doligez | Summary | Compiler ignores types in .cmi file => Compiler ignores types in .cmi file [problems with #trace] |
| 2006-03-29 16:23 | doligez | Description Updated | |
| 2006-03-29 16:23 | doligez | Additional Information Updated | |
| 2006-03-29 16:42 | doligez | Category | Incoming => OCaml general |
| 2012-09-06 16:43 | doligez | Target Version | => 4.00.1+dev |
| 2012-09-11 14:47 | doligez | Target Version | 4.00.1+dev => 4.01.0+dev |
| Copyright © 2000 - 2011 MantisBT Group |