Versions Compared

Key

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

Code that is never executed is known as dead code. Typically, the presence of dead code indicates that a logic error has occurred as a result of changes to a program or the program's environment. Dead code is usually optimized out of a program during compilation. However, to improve readability and ensure that logic errors are resolved, dead code should be identified, understood, and eliminated.

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

MSC07-C

lowLow

unlikelyUnlikely

mediumMedium

P2

L3

Automated Detection

Tool

Version

Checker

Description

Coverity

Include Page
Coverity_V
Coverity_V

DEADCODE


UNREACHABLE

Can detect the specific instance where code can never be reached because of a logical contradiction or a dead "default" in switch statement

Can detect the instances where code block is unreachable because of the syntactic structure of the code

GCC

Include Page
GCC_V
GCC_V

 

Can detect violations of this recommendation when the -Wunreachable-code flag is used

Klocwork

Include Page
Klocwork_V
Klocwork_V

LV_UNUSED.GEN VA_UNUSED.* UNREACH.*

 

LDRA tool suite

Include Page
LDRA_V
LDRA_V

1 J
139 S
140 S

Fully implemented

PRQA QA-C
Include Page
PRQA_V
PRQA_V

0689
2008
3110
3112
3196
3201
3202
3203
3205
3206
3207
3210
3219
3229
3307
3328
3355
3356
3357
3358
3359
3360
3404
3422
3423
3425
3426
3427
3470

Fully implemented

Splint

Include Page
Splint_V
Splint_V

 

Can detect violations of this recommendation when the -Wunreachable-code flag is used

Related Vulnerabilities

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

...