Skip to content

Commit b5758c7

Browse files
authored
Fix bounds check in cloneM, add CI with -fdebug (#331)
Fixes #330, #329.
1 parent 7381d5a commit b5758c7

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.github/workflows/haskell-ci.yml

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# This GitHub workflow config has been generated by a script via
22
#
3-
# haskell-ci 'github' '--benchmarks-jobs= < 9.2' '--installed=-containers' '--installed=-binary' 'unordered-containers.cabal' '--branches=master'
3+
# haskell-ci 'github' 'unordered-containers.cabal'
44
#
55
# To regenerate the script (for example after adjusting tested-with) run
66
#
77
# haskell-ci regenerate
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.13.20211030
11+
# version: 0.13.20211116
1212
#
13-
# REGENDATA ("0.13.20211030",["github","--benchmarks-jobs= < 9.2","--installed=-containers","--installed=-binary","unordered-containers.cabal","--branches=master"])
13+
# REGENDATA ("0.13.20211116",["github","unordered-containers.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -24,6 +24,8 @@ jobs:
2424
linux:
2525
name: Haskell-CI - Linux - ${{ matrix.compiler }}
2626
runs-on: ubuntu-18.04
27+
timeout-minutes:
28+
60
2729
container:
2830
image: buildpack-deps:bionic
2931
continue-on-error: ${{ matrix.allow-failure }}
@@ -149,6 +151,10 @@ jobs:
149151
repository hackage.haskell.org
150152
url: http://hackage.haskell.org/
151153
EOF
154+
cat >> $CABAL_CONFIG <<EOF
155+
program-default-options
156+
ghc-options: $GHCJOBS +RTS -M3G -RTS
157+
EOF
152158
cat $CABAL_CONFIG
153159
- name: versions
154160
run: |
@@ -233,3 +239,11 @@ jobs:
233239
run: |
234240
rm -f cabal.project.local
235241
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
242+
- name: prepare for constraint sets
243+
run: |
244+
rm -f cabal.project.local
245+
- name: constraint set debug
246+
run: |
247+
$CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='unordered-containers +debug' --dependencies-only -j2 all
248+
$CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='unordered-containers +debug' all
249+
$CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='unordered-containers +debug' all

Data/HashMap/Internal/Array.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ copyM !src !_sidx@(I# sidx#) !dst !_didx@(I# didx#) _n@(I# n#) =
281281

282282
cloneM :: MArray s a -> Int -> Int -> ST s (MArray s a)
283283
cloneM _mary@(MArray mary#) _off@(I# off#) _len@(I# len#) =
284-
CHECK_BOUNDS("cloneM_off", lengthM _mary, _off - 1)
284+
CHECK_BOUNDS("cloneM_off", lengthM _mary, _off)
285285
CHECK_BOUNDS("cloneM_end", lengthM _mary, _off + _len - 1)
286286
ST $ \ s ->
287287
case cloneSmallMutableArray# mary# off# len# s of

cabal.haskell-ci

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- Configuration for haskell-ci
2+
3+
branches: master
4+
5+
-- Due to https://github.com/haskell-foundation/foundation/issues/554 via gauge.
6+
benchmarks: <9.2
7+
8+
constraint-set debug
9+
constraints: unordered-containers +debug
10+
tests: True
11+
run-tests: True
12+
13+
installed: -containers
14+
installed: -binary

0 commit comments

Comments
 (0)