Ticket #2669 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

"index out of range" error message regression

Reported by: claus Owned by:
Priority: normal Milestone: 6.12.1
Component: None Version: 6.11
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

In ghci 6.4.1, we get some useful information with the error:

Prelude> :m +Data.Array.IArray
Prelude Data.Array.IArray> (listArray (1,4) [1..4] :: Array Int Int) ! 5
*** Exception: Ix{Int}.index: Index (5) out of range ((1,4))

In ghci 6.8.3, that disappeared:

Prelude> :m +Data.Array.IArray
Prelude Data.Array.IArray> (listArray (1,4) [1..4] :: Array Int Int) ! 5
Loading package array-0.1.0.0 ... linking ... done.
*** Exception: Error in array index

ghci 6.11.20081004 is similarly unhelpful:

Prelude> :m +Data.Array.IArray
Prelude Data.Array.IArray> (listArray (1,4) [1..4] :: Array Int Int) ! 5
Loading package syb ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
*** Exception: Error in array index

Change History

Changed 3 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.10 branch

We now check the Int offsets rather than the checking that we are inside the Ix range, which is presumably why the error changed.

Changed 3 years ago by igloo

  • milestone changed from 6.10 branch to 6.12.1

See also #2120.

Changed 3 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Fixed by these patches in array and base:

Sun Jul 19 16:29:31 BST 2009  Ian Lynagh <igloo@earth.li>
  * Improve the index checking for array accesses; fixes #2120 #2669
  As well as checking that offset we are reading is actually inside the
  array, we now also check that it is "in range" as defined by the Ix
  instance. This fixes confusing behaviour (#2120) and improves some error
  messages (#2669).

Sun Jul 19 16:32:28 BST 2009  Ian Lynagh <igloo@earth.li>
  * Improve the index checking for array accesses; fixes #2120 #2669
  As well as checking that offset we are reading is actually inside the
  array, we now also check that it is "in range" as defined by the Ix
  instance. This fixes confusing behaviour (#2120) and improves some error
  messages (#2669).
Note: See TracTickets for help on using tickets.