[GHC] #15092: Optionally bounds-check primops
GHC
ghc-devs at haskell.org
Thu Apr 26 22:45:44 UTC 2018
#15092: Optionally bounds-check primops
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.2.2
(CodeGen) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
It would be awfully nice if there were a way to optionally get bounds-
checked versions of array primitives. The idea would be that if GHC is
compiled with a bounds-checking option, then the code generator would use
primops that verify indices are in bounds. Based on
[https://mail.haskell.org/pipermail/haskell-cafe/2018-April/128992.html a
question by Henning Thielemann], I suspect such a feature would get some
use.
The biggest challenge: `SomeException`, `Typeable`, `Show`, `String`,
`CallStack`, etc., all live in an entirely different universe than the
primops, so it's not exactly obvious how to get started. I don't know if
it would be possible to inject references to such things into a lower
level. Sounds hard, but maybe it's possible.
An alternative, probably much simpler, approach would be to crash hard
with an error message instead of trying to throw a proper exception.
Ideally, the error message would include the name of the primop and (for
modules compiled with profiling) some call stack info.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15092>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list