I mistakenly forgot to include the name of a function when writing a statement. Only in debugging did I find this out as everything compiled fine. I am surprised that gcc did not produce a warning for a C program like this.
int x =0, a=1, b=2, c=3, d=4, e=5, f=6, g=7;
printf("\n%d %d %d %d %d %d %d %d\n",x,a,b,c,d,e,f,g);
x = (a,g=b+c,d,e,f);
printf("\n%d %d %d %d %d %d %d %d\n",x,a,b,c,d,e,f,g);
x = a,g=b+c,d,e,f;
printf("\n%d %d %d %d %d %d %d %d\n",x,a,b,c,d,e,f,g);
The code should have read functionName(a,g=b+c,d,e,f) but was missing the function name.
The syntax x = (a,g=b+c,d,e,f) results in x = f The syntax x = a,g=b+c,d,e,f results in x = a
In both cases g was properly calculated as b+c.
Wouldn't a warning of the first version x = (...) been in order? What valid stand alone expression would appear with (...) in this way. The byproduct is the inclusion or exclusion of the parens also results in two different values for x. Setting x=f due to the parens looks like a fall out from the way the machine code was generated as opposed to being syntactically driven.
Seems that a warning should have been flagged that perhaps this grouped expression was really the parameters of a missing function call. Better to catch a warning like this than having to discover the issue during debugging.