For an implementation that packs f0
and f1
into the same byte, is the program below defined?
struct S0 {
unsigned f0:4;
signed f1:4;
} l_62;
int main (void) {
(l_62.f0 = 0) + (l_62.f1 = 0);
return 0;
}
I am interested in the answer for C99 and for C11 if there is reason to think that it is different there.
In C99, all I found was 6.5:2:
Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. [...]
It is not clear for me what consequences this paragraph has on the program above.
Based on a large number of randomized tests, most compilers appear to generate code where the two assignments do not interfere.