summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-12-07 08:47:16 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-21 01:46:00 -0500
commit5ff47ff5bb815e18e03fab42ffae7d735ea70976 (patch)
treea866f6b824ff746bc3837cfb5b74d0636ace6ae7 /docs
parent887d8b4c409c06257a63751e4e84c86ddf5cc874 (diff)
downloadhaskell-5ff47ff5bb815e18e03fab42ffae7d735ea70976.tar.gz
codeGen: Introduce flag to bounds-check array accesses
Here we introduce code generator support for instrument array primops with bounds checking, enabled with the `-fcheck-prim-bounds` flag. Introduced to debug #20769.
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/debugging.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst
index 569923ade4..77bb7f0e2c 100644
--- a/docs/users_guide/debugging.rst
+++ b/docs/users_guide/debugging.rst
@@ -999,6 +999,18 @@ Checking for consistency
cases. This is helpful when debugging demand analysis or type checker bugs
which can sometimes manifest as segmentation faults.
+.. ghc-flag:: -fcheck-prim-bounds
+ :shortdesc: Instrument array primops with bounds checks.
+ :type: dynamic
+
+ Typically primops operations like ``writeArray#`` exhibit unsafe behavior,
+ relying on the user to perform any bounds checking. This flag instructs the
+ code generator to instrument such operations with bound checking logic
+ which aborts the program when an out-of-bounds access is detected.
+
+ Note that this is only intended to be used as a debugging measure, not as
+ the primary means of catching out-of-bounds accesses.
+
.. _checking-determinism:
Checking for determinism