| Anonymous | Login | Signup for a new account | 2013-05-20 05:21 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 | |||
| 0000156 | OCaml | OCaml general | public | 2000-07-06 18:40 | 2000-07-08 21:04 | |||
| Reporter | administrator | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | ||||||||
| Target Version | Fixed in Version | |||||||
| Summary | 0000156: Bug is List.sort | |||||||
| Description | Hello, The following program crashes: let _ = let a = Array.init 100 (fun _ -> Random.float 1.0) in let l = Array.to_list a in let l = List.sort compare l in () Fatal error: uncaught exception Invalid_argument("Array.get") It must be a bug in List.sort, because with Array.sort this works fine. I may add a request, as has been discussed in the list recently, to add an optional feature that shows where the exception was thrown. This (new) bug has occured in a 100,000 lines of code system (Ensemble). It is difficult to find a bug in such a large system without language level help. Thanks, Ohad. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0000415) administrator (administrator) 2000-07-08 21:04 |
>From: orodeh@cs.huji.ac.il > let _ = > let a = Array.init 100 (fun _ -> Random.float 1.0) in > let l = Array.to_list a in > let l = List.sort compare l in > () > > Fatal error: uncaught exception Invalid_argument("Array.get") > > > It must be a bug in List.sort, because with Array.sort this works fine. This is a bug in Obj.truncate, which makes List.sort fail on all lists of floats (except the empty list), but only on 32-bit machines. Many thanks for finding and reporting the bug. I'm including a patch at the end of this mail. -- Damien Index: byterun/obj.c =================================================================== RCS file: /net/pauillac/caml/repository/csl/byterun/obj.c,v retrieving revision 1.13 diff -c -r1.13 obj.c *** obj.c 2000/04/03 08:34:22 1.13 --- obj.c 2000/07/08 18:33:33 *************** *** 102,107 **** --- 102,109 ---- mlsize_t wosize = Wosize_hd (hd); mlsize_t i; + if (tag == Double_array_tag) new_wosize *= Double_wosize; /* PR#156 */ + if (new_wosize <= 0 || new_wosize > wosize) invalid_argument ("Obj.truncate"); if (new_wosize == wosize) return Val_unit; |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| Copyright © 2000 - 2011 MantisBT Group |