...
If expressions that appear to produce side effects are an unevaluated operand, 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 |
---|---|---|---|---|---|
EXP52-CPP | Low | Unlikely | Low | P3 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Astrée |
| sizeof | Partially checked | ||||||
Axivion Bauhaus Suite |
| CertC++-EXP52 | |||||||
Clang |
| -Wunevaluated-expression |
CodeSonar |
| LANG.STRUCT.SE.SIZEOF | Side Effects in sizeof | ||||||
Helix QAC |
| C++3240, C++3241 | |||||||
Klocwork |
| MISRA.SIZEOF.SIDE_EFFECT |
LDRA tool suite |
| 54 S, 133 S | Partially implemented | ||||||
Parasoft C/C++test |
|
|
|
3240, 3241
CERT_CPP-EXP52-a | The operand of the sizeof operator shall not contain any expression which has side effects | ||||||||
Polyspace Bug Finder |
| CERT C++: EXP52-CPP | Checks for logical operator operand with side effects | ||||||
RuleChecker |
| sizeof | Partially checked |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
SEI CERT C Coding Standard | EXP44-C. Do not rely on side effects in operands to sizeof, _Alignof, or _Generic |
Bibliography
...