This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2970. Races with volatile sig_atomic_t bit-fields

Section: 6.9.2.2  [intro.races]     Status: open     Submitter: Hubert Tong     Date: 2024-12-17

(From submission #654.)

Subclause 6.9.2.2 [intro.races] paragraph 22 specifies:

Two accesses to the same object of type volatile std::sig_atomic_t do not result in a data race if both occur in the same thread, even if one or more occurs in a signal handler. ...

This provision applies to bit-fields as well, because bit-fields are objects (6.8.1 [basic.types.general] paragraph 4). However, in practice bit-fields are not updated atomically and are subject to tearing.

Suggested resolution:

Change in 6.9.2.2 [intro.races] paragraph 22 as follows:

Two accesses to the same non-bit-field object of type volatile std::sig_atomic_t do not result in a data race if both occur in the same thread, even if one or more occurs in a signal handler. ...