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
ocaml crash after use scanf.ml;; sscanf ... #3529
Comments
Comment author: administrator
Thank you for your interest for Objective Caml and tahnk you for a However, I'm afraid this is not a bug, but a misusage of the Scanf First of all, remember that the Scanf module is ... a module! In other Hence, you should not forget to use the interface of Scanf with the vignaud:~$ ocaml #use "src/csl/stdlib/scanf.ml";;module type SCANNING = open Scanf;;let q = sscanf "10 11" "%d %d" (fun x y -> print_endline (x ^ y));;This expression has type int but is here used with type string Admittedly, we can directly restrict the type of the functions In conclusion, don't #use random files from the Caml compiler Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ |
Comment author: administrator scanf.ml is not designed to be #use -ed. |
Original bug ID: 1324
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Nick Alexander
Version: 3.05
OS: Win2k, Mac OS X
Submission from: h209-139-221-124.gtconnect.net (209.139.221.124)
Hello,
If I try, in the ocamlwin toplevel under Win2k, something like:
Objective Caml version 3.05
open Scanf;;
let q = sscanf "10 11" "%d %d" (fun x y -> print_endline (x ^ y));;
Characters 58-59:
let q = sscanf "10 11" "%d %d" (fun x y -> print_endline (x ^ y));;
^
This expression has type int but is here used with type string
I get good type checking.
When I try:
#use "C:/Program Files/Objective Caml/lib/scanf.ml";;
module type SCANNING =
[ load elided ]
let q = sscanf "10 11" "%d %d" (fun x y -> print_endline (x ^ y));;
I get a hard crash (segfault) with invalid memory access.
A friend verified this behaviour under Mac OS X.
Nick Alexander
The text was updated successfully, but these errors were encountered: