MISRAC2012-Rule-9.7
In this section:
Synopsis
(Mandatory) Atomic objects shall be appropriately initialized before being accessed.
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Uninitalized Atomic object accessed.
Coding standards
- MISRA C:2012 Rule-9.7
(Mandatory) Atomic objects shall be appropriately initialized before being accessed
Code examples
The following code example fails the check and will give a warning:
void example() {
_Atomic int ai2;
ai2 = 777; /* Non-compliant - not initialized by atomic_init */
}
The following code example passes the check and will not give a warning about this issue:
_Atomic int g_ai1; /* Compliant - default initialization */