Warning[...]: undefined behavior: the order of volatile accesses is undefined in this statement x.cpp xxx
Why this line is undefined behavior?
case 2: Vdda = 3.3 * (*VREFINT_CAL) / ADC_DR->DATA; Where the declarations/initializations are:
volatile short const *VREFINT_CAL = (short *) 0x1FFFF7BA; and
volatile STRUCT_ADC_DR *ADC_DR = (STRUCT_ADC_DR*) 0x40012440; defined by:
typedef struct { unsigned DATA : 16; unsigned : 16; } STRUCT_ADC_DR; Is it because the compiler isn't sure about the volatile elements could act diferent in the order they get accessed? (What is the case)
But shouldn't it be ensured that the calculation gets performed from left to right as the operators have the same priority?