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


2901. Unclear semantics for near-match aliased access

Section:7.2.1  [basic.lval]    Status:CD7    Submitter:Jan Schultke    Date:2024-06-14

[Accepted as a DR at the November, 2024 meeting.]

(From submission#548.)

Subclause 7.2.1 [basic.lval] paragraph 11 specifies:

... If a program attempts to access (3.1 [defns.access]) the storedvalue of an object through a glvalue through which it is nottype-accessible, the behavior is undefined. ...

Thus, access (read or write) to anint object using anlvalue of typeunsigned int is valid. However,7.3.2 [conv.lval] bullet 3.4 does not specify the resultingvalue when, for example, the object contains the value -1:

Similarly, 7.6.19 [expr.assign] paragraph 2 is silent for theassignment case:

In simple assignment (=), the object referred to by the left operandis modified (3.1 [defns.access]) by replacing its value with theresult of the right operand.

Any concerns about accesses to the object representation are handled in the context ofP1839.

Proposed resolution (approved by CWG 2024-09-13):

  1. Change in 7.3.2 [conv.lval] bullet 3.4 as follows:

    • Otherwise, the object indicated by the glvalue is read(3.1 [defns.access]), and the value contained in the objectis the prvalue result. LetV be the value containedin the object. IfT is an integer type, the prvalue resultis the value of typeT congruent (6.9.2 [basic.fundamental])toV, andV otherwise. ...
  2. Change in 7.6.1.6 [expr.post.incr] paragraph 1 as follows:

    The value of a postfix ++ expression is the valueofobtained by applying the lvalue-to-rvalue conversion(7.3.2 [conv.lval]) to its operand. [Note 1:The value obtained is a copy of the original value. —endnote] ...
  3. Change in 7.6.19 [expr.assign] paragraph 2 as follows:

    In simple assignment (=),letV be the result of the rightoperand; the object referred to by the left operand is modified(3.1 [defns.access]) by replacing its value withthe resultof the right operandV or, if the object is of integertype, with the value congruent (6.9.2 [basic.fundamental]) toV.



[8]ページ先頭

©2009-2026 Movatter.jp