Movatterモバイル変換


[0]ホーム

URL:


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

2025-12-20


2146. Scalar object vs memory location in definition of “unsequenced”

Section:6.10.1  [intro.execution]    Status:CD4    Submitter:Jens Maurer    Date:2015-06-22

[Adopted at the February, 2016 meeting.]

According to 6.10.1 [intro.execution] paragraph 15,

If a side effect on a scalar object is unsequenced relativeto either another side effect on the same scalar object or avalue computation using the value of the same scalar object,and they are not potentially concurrent(6.10.2 [intro.multithread]), the behavior is undefined.

Should this refer to “memory location,” whichalso encompasses contiguous bit-fields, as the definition ofdata races in 6.10.2 [intro.multithread] does? For example,

  struct S {    int x : 4;    int y : 4;    int z : 4;  };  void f(int, int, int);  int g(int, S&);  int main(int argc, char ** argv) {    S s = { argc, argc+1, argc+2 };    f(++s.x, g(++s.y, s), ++s.z);  }

Proposed resolution (February, 2016):

Change 6.10.1 [intro.execution] paragraph 15 as follows:

...If a side effect on ascalarobjectmemory location(6.8.1 [intro.memory]) is unsequenced relative toeither another side effect on the samescalarobjectmemory location or a valuecomputation using the value ofany object in thesamescalar objectmemory location,and they are not potentially concurrent(6.10.2 [intro.multithread]), the behavior isundefined. [Note: The next section...



[8]ページ先頭

©2009-2026 Movatter.jp