Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

An object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. Referencing a volatile object by using a nonvolatile value results in undefined behavior. The C Standard, subclause 6.7.3 [ISO/IEC 9899:2011], states:

...

Noncompliant Code Example

In this noncompliant code example, a volatile object is accessed through a non-volatile-qualified reference, resulting in undefined behavior:

...

Casting away volatile allows access to an object through a nonvolatile reference and can result in undefined and perhaps unintended program behavior.

...

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...