"The order of volatile accesses is undefined in this statement" 경고문
2018-02-28 오전 1:48
The message below is issued if 2 (or more) of the variables in a C statement are volatile.
Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
The central information the message is the text "...order of volatile accesses is undefined..." . That is, IAR C/C++ Compiler will (as it follows the ISO/ANSI standard) access the variables in an order that is not defined.
Q. Is this a problem , or not?
A. Well that depends on your application.
Volatile is (typically) used for variables that are accessed from several threads in the application, and for Special Function Register that are the connection in/out of the chip. So you must study the volatile variables that are present in this C statement and from the usage of these volatile variables decide if you must make a change or not.
How to change
The change is to break up the C statement, so that each new C statement holds only one access to a volatile variable. In this small example the variables internalChannelSelect and ADC are volatile. If so, the following C source will issue the "Warning[Pa082]".
intAnalogSample[internalChannelSelect] = ADC[internalChannelSelect];
The following change will make the C source predictable. Note that the temporary variables are NOT volatile.
i = internalChannelSelect;
k = ADC[i];
intAnalogSample[i] = k;
All product names are trademarks or registered trademarks of their respective owners.