I ran into an "undefined behaviour" warning with IAR compiler for RL78 (v. 1.40.6) with the following code:
static volatile int x[2] = {1, 2};
int test(){
return x[0]+x[1];
}
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement C:\sandbox\test.c 32
The compiler tech note provides an explanation which boils down to two side effects (volatile accesses) being unsequenced.
However, I can see that the code above is no problem for newer compilers like GCC 8. Could someone point me to the change in the standard which makes accessing two volatile variables in a single statement legal?