...
If expressions that appear to produce side effects are supplied to an operator that does not evaluate its operands, the results may be different than expected. Depending on how this result is used, it can lead to unintended program behavior.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXP44-C | Low | Unlikely | Low | P3 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Astrée |
| sizeof | Partially checked | ||||||
Clang |
| -Wunevaluated-expression | Can diagnose some instance of this rule, but not all (such as the _Alignof NCCE). | ||||||
CodeSonar |
| LANG.STRUCT.SE.SIZEOF | Side effects in sizeof | ||||||
Compass/ROSE |
Coverity |
| MISRA C 2004 Rule 12.3 | Partially implemented | ||||||
| CC2.EXP06 | Fully implemented | |||||||
Klocwork |
| MISRA.SIZEOF.SIDE_EFFECT |
LDRA tool suite |
| 54 S, 653 S | Fully implemented | ||||||
Parasoft C/C++test |
|
|
| JSF-166{b,c} | Fully implemented | |||||||
R2018a | Side effect of expression ignored | sizeof, _Alignof, or _Generic operates on expression with side effect | |||||||
PRQA QA-C |
| 3307 | Fully implemented | ||||||
RuleChecker |
| sizeof | Partially checked |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
Key here (explains table format and definitions)
Taxonomy | Taxonomy item | Relationship |
---|---|---|
CERT C | EXP52-CPP. Do not rely on side effects in unevaluated operands | Prior to 2018-01-12: CERT: Unspecified Relationship |
...