Semantics of MODIFY_EXPR with CONSTRUCTOR rhs
Gabriel Dos Reis
gdr@integrable-solutions.net
Mon Aug 2 08:14:00 GMT 2004
| On Sun, Aug 01, 2004 at 11:20:06PM -0400, Richard Kenner wrote:
| > Suppose we have this in .t03.original:
| >
| > r = {.x=5, .y=8};
| > r = {.x=1, .y=r.x};
| >
| > Is the second statement valid?
The second statement is valid. The syntactic and grammatical validity
is no valid different from the situation
struct S {
void* data;
};
strust S s = { &s.data };
| ...
| > What's supposed to be happening here?
My understanding is that it is a behvaiour unspecified by the C99
standard, 6.7.8 Initialization:
[#23] The order in which any side effects occur among the
initialization list expressions is unspecified.130)
Footnote 130 says:
130In particular, the evaluation order need not be the same
as the order of subobject initialization.
I would suggest we warn user, and let optimizer decides ;-)
-- Gaby
More information about the Gcc
mailing list