| Anonymous | Login | Signup for a new account | 2013-05-20 07:19 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 | |||||||
| 0004659 | OCaml | OCaml general | public | 2008-11-29 22:52 | 2012-07-27 12:58 | |||||||
| Reporter | oliver | |||||||||||
| Assigned To | frisch | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||||||
| Status | resolved | Resolution | fixed | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | 3.10.2 | |||||||||||
| Target Version | 4.01.0+dev | Fixed in Version | ||||||||||
| Summary | 0004659: wrong error message (parser seems to interpret many lines as one line) (3.10.2 and 3.10.0) | |||||||||||
| Description | I get the following error message: =============== oliver@siouxsie:~/Desktop/Overwrite_file$ ocamlc unix.cma buggy.ml File "buggy.ml", line 20, characters 4-321: Warning F: this function application is partial, maybe some arguments are missing. oliver@siouxsie:~/Desktop/Overwrite_file$ =============== Line 20 has length of 41 bytes! The bug of my program is located in line 29, where I used Printf.printf, expecting an arg, but do not provide it. This means: the partial application is correctly mentioned by the compiler, but the line and char-in-line is reported wrongly. The problem occurs with ocamlc, ocamlopt and ocaml. | |||||||||||
| Additional Information | For first overview, I provide the result of "$ nl -ba buggy.ml", but I will attach the file for your convenience: 1 2 let mb x = x * 1024 * 1024 3 4 open Unix 5 6 let _ = 7 let filename = Sys.argv.(1) in 8 let filesize = (stat filename).st_size in 9 Printf.printf "%d\n" filesize; 10 11 let restbytes = ref filesize in 12 13 let strlen = mb 100 in 14 let string = String.make strlen ' ' in 15 let writesize = ref strlen in 16 17 let fd = openfile filename [O_RDWR] 0o640 in 18 while !restbytes > 0 19 do 20 writesize := (min !restbytes strlen); 21 22 Printf.printf "restbytes: %d, writesize: %d\n" !restbytes !writesize; 23 flush Pervasives.stdout; 24 25 let num = write fd string 0 !writesize in 26 restbytes := max 0 (!restbytes - num ); 27 28 Printf.printf "(just written: %d)\n" num; 29 Printf.printf "restbytes: %d\n-----------\n" (* HERE IS THE BUG! *) 30 31 done; 32 close fd 33 34 35 | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Relationships |
|||||||||||
|
|||||||||||
Notes |
|
|
(0004789) doligez (manager) 2008-12-03 14:24 |
In fact, the reported character range is correct (it goes from the 'w' in line 20 to the last quote in line 29). What is wrong with this error message is that it reports the whole sequence as the partially-applied function. It should report only its last subexpression (i.e. line 29). |
|
(0004790) doligez (manager) 2008-12-03 14:25 |
Maybe we should also switch to the new way of reporting character ranges used by Emacs. |
|
(0007823) frisch (developer) 2012-07-27 12:58 |
> It should report only its last subexpression (i.e. line 29). Fixed by 0005697. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2008-11-29 22:52 | oliver | New Issue | |
| 2008-11-29 22:52 | oliver | File Added: buggy.ml | |
| 2008-12-03 14:24 | doligez | Note Added: 0004789 | |
| 2008-12-03 14:24 | doligez | Severity | major => minor |
| 2008-12-03 14:24 | doligez | Status | new => acknowledged |
| 2008-12-03 14:25 | doligez | Note Added: 0004790 | |
| 2012-02-13 18:01 | doligez | Relationship added | related to 0005070 |
| 2012-07-11 15:01 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-11 15:03 | doligez | Relationship added | related to 0004598 |
| 2012-07-27 12:58 | frisch | Note Added: 0007823 | |
| 2012-07-27 12:58 | frisch | Status | acknowledged => resolved |
| 2012-07-27 12:58 | frisch | Resolution | open => fixed |
| 2012-07-27 12:58 | frisch | Assigned To | => frisch |
| Copyright © 2000 - 2011 MantisBT Group |