...
(See also undefined behavior 1514 of Annex J.)
Further, according to subclause 6.4.2.1,
...
(See also undefined behavior 3130 of Annex J.)
Identifiers in mutually visible scopes must be deemed unique by the compiler to prevent confusion about which variable or function is being referenced. Implementations can allow additional nonunique characters to be appended to the end of identifiers, making the identifiers appear unique while actually being indistinguishable.
...
Nonunique identifiers can lead to abnormal program termination, denial-of-service attacks, or unintended information disclosure.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
DCL23-C | Medium | Unlikely | Yes | YesLow | P6 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Astrée |
| Supported , but no explicit checkerindirectly via MISRA C:2012 Rules 5.1, 5.2, 5.3, 5.4 and 5.5. | |||||||||||||
| Axivion Bauhaus Suite |
| CertC-DCL23 | |||||||||||||
| CodeSonar |
| LANG.ID.ND.EXT LANG.ID.NU.EXT LANG.STRUCT.DECL.MGT | Non-distinct identifiers: external names Non-unique identifiers: external name Global variable declared with different types | ||||||||||||
| Compass/ROSE | Can detect some violations of this rule but cannot flag violations involving universal names | ||||||||||||||
| Helix QAC |
| C0627, C0776, C0777, C0778, C0779, C0789, C0791, C0793 | |||||||||||||
| Klocwork |
| MISRA.IDENT.DISTINCT.C99.2012 | |||||||||||||
| LDRA tool suite |
| 17 D | Fully implemented | ||||||||||||
| PC-lint Plus |
| 621 | Fully supported | ||||||||||||
| Polyspace Bug Finder |
| MISRA CERT C: 2012 Rule 5.1 | External identifiers shall be distinct Identifiers declared in the same scope and name space shall be distinct An identifier declared in an inner scope shall not hide an identifier declared in an outer scope Macro identifiers shall be distinct Identifiers shall be distinct from macro names | PRQA QA-C | |||||||||||
| Include Page | PRQA QA-C_v | PRQA QA-C_v | Checks for:
Rec. fully covered. | ||||||||||||
| RuleChecker |
| Supported indirectly via MISRA C:2012 Rules 5.1, 5.2, 5.3, 5.4 and 5.5. | 627, 776, 0777, 778, 0779 | Partially implemented||||||||||||
| SonarQube C/C++ Plugin |
| IdentifierLongerThan31 |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
| ISO/IEC TR 24772:2013 | Choice of Clear Names [NAI] Identifier Name Reuse [YOW] |
| MISRA C:2012 | Rule 5.1 (required) |
...