Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated references from C11->C23

The C Standard, 6.7.34, paragraph 7 [ISO/IEC 9899:20112024], states

If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is undefined.

...

Tool

Version

Checker

Description

Astrée

Include Page
Astrée_V
Astrée_V

assignment-to-non-modifiable-lvalue

pointer-qualifier-cast-const

pointer-qualifier-cast-const-implicit

write-to-constant-memory

Fully checked
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC-EXP40
Coverity
Include Page
Coverity_V
Coverity_V

PW

MISRA C 2004 Rule 11.5

Implemented
Cppcheck Premium

Include Page
Cppcheck Premium_V
Cppcheck Premium_V

premium-cert-exp40-cFully implemented
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C0563
LDRA tool suite
Include Page
LDRA_V
LDRA_V
582 SFully implemented
Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V
CERT_C-EXP40-a

A cast shall not remove any 'const' or 'volatile' qualification from the type of a pointer or reference

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C: Rule EXP40-CChecks for write operations on const qualified objects (rule fully covered)
RuleChecker

Include Page
RuleChecker_V
RuleChecker_V

assignment-to-non-modifiable-lvalue

pointer-qualifier-cast-const

pointer-qualifier-cast-const-implicit

Partially checked
TrustInSoft Analyzer

Include Page
TrustInSoft Analyzer_V
TrustInSoft Analyzer_V

mem_access

Exhaustively verified (see the compliant and the non-compliant example).

Related Vulnerabilities

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

...

Bibliography

[ISO/IEC 9899:20112024]Subclause 6.7.34, "Type Qualifiers"


...