N2507: accessing const objects from signal handlers

Submitter:Philipp Klaus Krause
Submission Date:2020-27-03

Summary:

Allow access to const objects from signal handlers.

This proposal follows up on N1812. N1812 was presented as a defect report and discussed at the 2014 Parma meeting. It was decided that a part of N1812 is a proposed normative change, not a defect. No follow-up happened on that part (the part considered a defect was fixed). This document proposes to make the normative change previously proposed as part of N1812 (with a slight modification to disallow accesses to const volatile objects).

Justification:

The wording on signal handlers seems very restrictive. It disallows signal handlers to refer to most objects. However, refering to an object without accessing it (e.g. for use in sizeof or to take an address) could be allowed in signal handlers. Also reading const objects could be allowed.

Proposed changes (vs. the standard draft N455):

Do we want to allow signal handlers to refer to objects, as long as the objects are not accessed?

In §7.14.1.1p5: Replace "the behavior is undefined if the signal handler refers to any object with static or thread storage duration that is not" by "the behavior is undefined if the signal handler accesses any object with static or thread storage duration that is not".

And make the corresponding change in §J.2.

Do we want to allow signal handlers to access const objects?

In §7.14.1.1p5: Replace "the behavior is undefined if the signal handler accesses any object with static or thread storage duration that is not" by "the behavior is undefined if the signal handler accesses any non-const or volatile object with static or thread storage duration that is not ".

And make the corresponding change in §J.2.