| Anonymous | Login | Signup for a new account | 2013-06-19 12:15 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 | |||
| 0004473 | OCaml | OCaml general | public | 2008-01-05 02:43 | 2008-01-18 04:54 | |||
| Reporter | sol | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | crash | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.10.1 | |||||||
| Target Version | Fixed in Version | 3.10+dev | ||||||
| Summary | 0004473: Segfault when accessing an element of an array of float throught a polymorphic method. | |||||||
| Description | Example: <code> class xyz = object method nth : 'a . int -> 'a array -> 'a = fun x a -> a.(x mod Array.length a) end </code> Running this with an array of string, int or options... works fine. But an array of float causes a segfault. Tested in versions: 3.09.3 on mac osx 10 and 3.10.0 on windows xp. However the following works fine: <code> let nth : int -> 'a array -> 'a = fun x a -> a.(x mod Array.length a) </code> | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0004404) xleroy (administrator) 2008-01-07 15:47 |
Confirmed in 3.10.1. The culprit is probably Typeopt.array_element_kind, which doesn't know about universally-quantified type variables. |
|
(0004405) sol (reporter) 2008-01-07 16:55 |
The following works as a workaround: First create a function and assign it to a class method. let nth : 'a array -> int -> 'a = fun a i -> a.(i mod Array.length a) class c = object method nth : 'a . 'a array -> int -> 'a = nth end |
|
(0004416) garrigue (manager) 2008-01-18 04:54 |
I commited the fix for Typeopt.array_element_kind in CVS. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2008-01-05 02:43 | sol | New Issue | |
| 2008-01-07 15:47 | xleroy | Note Added: 0004404 | |
| 2008-01-07 15:47 | xleroy | Status | new => confirmed |
| 2008-01-07 15:47 | xleroy | Product Version | 3.09.3 => 3.10.1 |
| 2008-01-07 16:55 | sol | Note Added: 0004405 | |
| 2008-01-18 04:54 | garrigue | Status | confirmed => closed |
| 2008-01-18 04:54 | garrigue | Note Added: 0004416 | |
| 2008-01-18 04:54 | garrigue | Resolution | open => fixed |
| 2008-01-18 04:54 | garrigue | Fixed in Version | => 3.10+dev |
| Copyright © 2000 - 2011 MantisBT Group |