| Anonymous | Login | Signup for a new account | 2013-05-24 15:49 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 | |||||||
| 0004892 | OCaml | OCaml general | public | 2009-10-15 00:35 | 2012-03-14 10:27 | |||||||
| Reporter | frisch | |||||||||||
| Assigned To | ||||||||||||
| Priority | low | Severity | minor | Reproducibility | always | |||||||
| Status | resolved | Resolution | fixed | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | ||||||||||||
| Target Version | Fixed in Version | 4.00.0+dev | ||||||||||
| Summary | 0004892: 'index out of bound' check too early? | |||||||||||
| Description | One expects arguments of a function call to be evaluated before the function is called. This is not the case in the following expression, using the native code compiler: let () = Array.set [| |] 0 (print_endline "XXX") The exception Invalid_argument("index out of bounds") is raised before the argument (print_endline "XXX") is evaluated. | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Relationships |
||||||
|
||||||
Notes |
|
|
(0005131) ertai (developer) 2009-10-15 15:12 |
Why do you expects the arguments of this function to be all evaluated before doing the update. Array.set could morally be seen as: let set array index = ...bound...check... array index; fun v -> ...update...code... Which have the nice property of checking once the bounds: let isetter = Array.set array i in let rec ... k = ... isetter k ... However the reports is still worthy since the behavior should be the same in bytecode. |
|
(0005132) frisch (developer) 2009-10-15 16:27 |
>Why do you expects the arguments of this function to be all evaluated before >doing the update. Because, in a call-by-value language, as I said, one expects arguments of a function call to be evaluated before the function is called. |
|
(0005133) doligez (manager) 2009-10-15 17:39 |
This bug seems to be a kind of dual to PR#2719... |
|
(0005140) frisch (developer) 2009-10-20 12:57 |
The bug is in Cmmgen.transl_prim_3 and the fix is straightforward (always bind "newval" to arg3). |
|
(0007070) xleroy (administrator) 2012-03-14 10:27 |
Fixed in 4.00 release branch (r12237) and in trunk (r12238). |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2009-10-15 00:35 | frisch | New Issue | |
| 2009-10-15 15:12 | ertai | Note Added: 0005131 | |
| 2009-10-15 16:27 | frisch | Note Added: 0005132 | |
| 2009-10-15 17:38 | doligez | Relationship added | related to 0002719 |
| 2009-10-15 17:39 | doligez | Note Added: 0005133 | |
| 2009-10-15 17:39 | doligez | Reproducibility | have not tried => always |
| 2009-10-15 17:39 | doligez | Status | new => acknowledged |
| 2009-10-20 12:57 | frisch | Note Added: 0005140 | |
| 2012-02-14 15:26 | gasche | Status | acknowledged => confirmed |
| 2012-03-14 10:27 | xleroy | Note Added: 0007070 | |
| 2012-03-14 10:27 | xleroy | Status | confirmed => resolved |
| 2012-03-14 10:27 | xleroy | Resolution | open => fixed |
| 2012-03-14 10:27 | xleroy | Fixed in Version | => 4.00.0+dev |
| Copyright © 2000 - 2011 MantisBT Group |