Modifying a variable through a pointer of an incompatible type (other than unsigned char) can lead to unpredictable results. This is often caused by a violation of aliasing rules. The C Standard, Section 6.5, para. paragraph 7 [ISO/IEC 9899:2011], specifies those circumstances in which an object may or may not be aliased.
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
EXP39-C | medium | unlikely | high | P2 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| PRQA QA-C |
| 0310 | Partially implemented |
Related Guidelines
| ISO/IEC TR TS 17961 | (Draft) Accessing an object through a pointer to an incompatible type [ptrcomp] |
|---|
...
| [Acton 2006] | "Understanding Strict Aliasing" |
| GCC Known Bugs | "C bugsBugs, Aliasing Issues while Casting to Incompatible Types" |
|---|---|
| GCC Manual | |
| [ISO/IEC 9899:2011] | Section 6.5, "Expressions" |
| [Walfridsson 2003] | Aliasing, Pointer Casts and GCC 3.3 |
...