JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
One of the following occurs in a statement-level expression, or between two sequence points.
| Class Name | Indeterminate Order of Evaluation | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | reliability | |||||||||||||||||||||||||||||||||
| Mnemonic | LANG.STRUCT.SE.IOE | |||||||||||||||||||||||||||||||||
| Categories |
|
|||||||||||||||||||||||||||||||||
| Availability | Available for C and C++. |
|||||||||||||||||||||||||||||||||
| Enabling | Checks for this warning class are disabled by default,
and require the unnormalized
C ASTs for the project. To enable them, add the following
WARNING_FILTER rule and RETAIN_UNNORMALIZED_C_AST specification to the project configuration file.
RETAIN_UNNORMALIZED_C_AST = Yes WARNING_FILTER += allow class="Indeterminate Order of Evaluation" |
int lang_struct_se_ioe(int x){
int rv1 = ++x - ++x; /* 'Indeterminate Order of Evaluation' warning issued here
* - two unsequenced writes to x
* The different orderings have different outcomes:
* - if the compiler chooses to perform the first increment
* before the second, (++x - ++x) == -1
* - if the compiler chooses to perform the second increment
* before the first, (++x - ++x) == 1
*/
int rv2 = ++x + ++x; /* 'Indeterminate Order of Evaluation' warning issued here
* - two unsequenced writes to x
* Ihe value of (++x + ++x) is the same under
* all possible sequencings, but a warning is
* issued regardless.
*/
int rv3 = (--x > 0) || (++x < 0); /* ok: || is a sequence point */
int rv4 = x + 2*x; /* ok: no writes to x */
++rv4; /* ok: the value read from rv4 contributes to the value written to rv4 */
return ++rv1 + ++rv2 + ++rv3 + ++rv4; /* ok: each object is only incremented once */
}
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.