Tim Rentsch wrote:
> Marcin Grzegorczyk<> writes:
>> Tim Rentsch wrote:
>>> Marcin Grzegorczyk<> writes:
>>>> Consider this example:
>>>>
>>>> struct { unsigned x:5, y:6, z:7; } s;
>>>> unsigned u;
>>>> /* ... */
>>>> s.x = (s.x++, u);
>>>>
>>>> In a typical implementation, either update of `s.x` will require
>>>> reading the container object first. Now the question is: is that read
>>>> access considered a part of the side effect, or may it be considered a
>>>> part of value computation (as defined in 5.1.2.3)? If the latter,
>>>> then the behaviour is undefined.
>>>
>>> That may be true but it's irrelevant to the semantics defined for
>>> the abstract machine. In the abstract machine, assigning to an
>>> lvalue commences at the point of evaluting the assignment operator,
>>> not before.
>>
>> That's your interpretation. 
>
> Yes, it is my opinion on this point that my comment about
> assignment semantics and the abstract machine is the only
> sensible reading of the relevant portions in the Standard, and
> that it matches what the authors intended and expect. It is
> also, as far as I know, the opinion of every other person
> informed on the subject, including those who have taken the
> time to try to write formal descriptions of the semantics
> of C's sequencing rules.
>
> Do you have anything to offer here other than a statement of
> your own opinion, which seems to be at odds with everyone
> else who is informed on the subject?
No. It just occurred to me, while analysing the code examples that
started this thread, that the text of the Standard is not entirely clear
on this point (at least to me). And if I could interpret the Standard
in a way suggesting that my bit-field example leads to undefined
behaviour, so could someone who, say, implemented a C compiler, I guess.
That's why, as a programmer, I'd like to know if the Committee
believes there is, indeed, a possibility of UB there.
6.5.16.1p3 may be particularly relevant in this context; it specifies a
semantic constraint on the assignment operator that does not follow from
the abstract machine and sequencing constraints.
>> I think this issue deserves a clarification from the WG14.
>> (How does one go about filing a Defect Report, anyway?)
>
> I would say such clarification already exists in the new language
> regarding sequencing given in N1425 etc, of which Larry Jones has
> said that it expresses what the group intended all along. But
> don't let that stop you from filing a Defect Report,
I'd like to, but I have no idea how one does that...
> and please
> post something in the newsgroup if you do file one.
Sure.
*If*.
As a matter of fact, there are a few other issues I'd like to be
clarified as well; I mentioned one of those (compatibility of
structures with FAMs) not long ago, in a thread cross-posted to comp.std.c.
--
Marcin Grzegorczyk