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

2024-11-11


2816. Unclear phrasing "may assume ... eventually"

Section: 6.9.2.3  [intro.progress]     Status: review     Submitter: Jiang An     Date: 2023-04-26

Subclause 6.9.2.3 [intro.progress] paragraph 1 specifies:

The implementation may assume that any thread will eventually do one of the following:

This formulation has two issues. First, what are the consequences of the user violation the assumption? It should be clearly specified that undefined behavior results. Second, what does "eventually" mean? The wording gives the impression that the requirement is satisfied if a thread performs some I/O operation at its beginning and then goes into an empty infinite loop.

It was also noted that that 6.9.2.3 [intro.progress] paragraph 3 is a near-duplicate of paragraph 1.

Possible resolution:

  1. Remove 6.9.2.3 [intro.progress] paragraph 1:

    The implementation may assume that any thread will eventually do one of the following:
    • terminate,
    • make a call to a library I/O function,
    • perform an access through a volatile glvalue, or
    • perform a synchronization operation or an atomic operation.
    [Note 1: This is intended to allow compiler transformations such as removal of empty loops, even when termination cannot be proven. —end note]
  2. Change in 6.9.2.3 [intro.progress] paragraph 5 as follows:

    The behavior is undefined if a thread of execution that has not terminated stops making execution steps. [Note: This is intended to allow compiler transformations such as removal of empty loops, even when termination cannot be proven. Because of this and the preceding requirement regarding what threads of execution have to perform eventually, it It follows that no thread of execution can execute forever without an execution step occurring. —end note]