On Wed, 9 Sep 2020 at 17:30, Charles Mills <[email protected]> wrote:

I think faulting on dereferencing 0 is a hardware function and yes, most
> hardware does so. Not so Z, where traditionally much of the "API" is
> chained off of the PSA.e unable to reference the PSA via a pointer variable.
>

Newish zArch has  a number of instructions of the form xxx AND TRAP, where
xxx is COMPARE or LOAD with various modifiers. These fault upon a zero
result, but lead to a "compare-and-trap-instruction data exception" rather
than, say, an addressing or protection exception. I don't know if the C
compiler can be convinced to emit them, and if there is z/OS infrastructure
to capture the resulting exceptions.

Tony H.

Reply via email to