Desk summary
- 01When requirements-based tests leave code unexecuted, that noncovered code is a symptom, not a category. Most of it turns out to be a missing requirement, a missing test or a logic error.
- 02Extraneous code does not trace to any requirement. Dead code is the subset of extraneous code that can never execute in any configuration. Both must be removed, with an analysis of the effect of removal and re-verification.
- 03Deactivated code is the opposite of an accident: it traces to requirements and is switched off by design, either permanently (category one) or in some configurations (category two).
- 04Category one needs a verified deactivation mechanism; category two must be developed and verified to the full software level as if it were active.
- 05Defensive code, embedded identifiers (checksums, part numbers) and code that never reaches the executable are not dead code, but each needs to be justified.
- 06Find it early: run tests and coverage continuously, keep trace data current, and treat late removal after the for-score test run with great care.
Intuition
Think of it like rooms in a building
Dead code is a room with no door: built by mistake, nobody can ever get in, and it should not be on the drawings. Extraneous code is a room that is not on the drawings at all — maybe a leftover from the previous tenant — whether or not there is a door. Deactivated code is a room on the drawings with a locked door: the plant room only maintenance staff enter, or the second galley only some airlines buy. The building inspector accepts the locked room if the lock is proven and the room is built to code; the room with no door, or the room nobody can explain, has to go.
Definitions, and what changed from DO-178B
Noncovered code
Any code (or object code) not exercised by requirements-based testing, as found by structural coverage analysis (§6.4.4.2). Not itself a defined category; it must be resolved into one of the categories below.
Extraneous code
Code or data that does not trace to any system or software requirement. Example: legacy code kept after its requirement and tests were deleted. New term in DO-178C. Includes dead code.
Dead code
Executable object code or data that exists because of a development error and cannot be executed or used in any operational configuration of the target. Does not trace to a requirement. A subset of extraneous code.
Deactivated code
Executable object code or data that traces to a requirement and is by design either (a) never intended to execute, such as unused library functions, unused parts of reused components or future-growth code; or (b) executed only in certain target configurations, such as option-selected or pin-selected functions.
DO-178B vs DO-178C
DO-178B (1992)
DO-178C (2011)
§6.4.4.3 names the resolution for each category, including deactivated category one and two.c
/* Dead code: the inner branch can never be reached. */
if (gear_up && flaps_up && !on_ground) {
compute_climb_schedule();
if (on_ground) { /* contradicts the outer condition */
compute_taxi_speed(); /* DEAD: no input can reach this */
}
}
/* Extraneous but reachable: no requirement mentions it. */
if (test_mode_flag == 0x5A) { /* left over from bench testing */
dump_ram_to_bus();
}
/* Defensive code: required by the coding standard, not dead. */
switch (flap_cmd) {
case FLAP_0: set_flaps(0); break;
case FLAP_15: set_flaps(15); break;
case FLAP_30: set_flaps(30); break;
default: hold_last_valid(); report_fault(); break; /* unreachable if input validated, but kept */
}How coverage analysis finds it, and how to resolve it
Structural coverage analysis compares the code executed by requirements-based tests with the code that exists (see Structural Coverage & MC/DC). Every gap must be resolved under DO-178C §6.4.4.3. Resist labelling gaps too early: experienced reviewers find that the bulk of initially uncovered code is caused by missing or ambiguous requirements, missing test cases or plain logic errors — not by dead code.
Resolving a coverage gap (DO-178C §6.4.4.3)
| Cause found | What it means | Resolution |
|---|---|---|
| Shortcoming in test cases or procedures | Requirement exists, test does not exercise it | Add or fix tests; re-run; re-measure coverage |
| Inadequate requirements | Code does something the requirements do not describe, but should | Update requirements (possibly derived, fed back to safety); add tests |
| Extraneous code (including dead code) | Code with no requirement | Remove it; analyse the effect of removal and the need for re-verification |
| Deactivated code, category one | Traceable, never meant to run in any configuration | Show by analysis and test that the deactivation means prevents execution |
| Deactivated code, category two | Traceable, runs only in some configurations | Establish the configuration in which it runs and add tests there to achieve coverage |
| Code not executable by test but required (e.g. defensive) | Requirement exists; test cannot reach it in normal conditions | Verify by other means: analysis, inspection, fault injection, or test in a special set-up |
Pitfall
Zombie code
Code that looks dead sometimes isn’t: an obscure interrupt path, a timing side effect, or an address the linker relies on. One company called it “zombie code” because it kept coming back to life after removal. Never remove code on a hunch late in the program; confirm with analysis, then re-verify proportionately. And never reclassify dead code as deactivated at the end of a project — deactivated code is planned and designed, dead code is not.
Practitioner tip
Avoiding late surprises
Review code specifically for traceability to requirements; update trace data with every change; run tests and coverage on every build, long before the for-score run; schedule time to resolve gaps instead of assuming a clean run; and write a procedure, with examples, for classifying noncovered code so every engineer resolves gaps the same way.
Note
Compiler-generated code at level A
Most projects measure coverage on source code. At level A, the source-to-object analysis (Table A-7 objective 9) must also show the compiler did not add untraceable object code. Any extra code the compiler inserts — range checks, helper routines, padding — must be explained and verified, and if it is truly extraneous it is handled the same way.
Deactivated code: categories one and two
The two categories of deactivated code
| Category one | Category two | |
|---|---|---|
| Intent | Never executed in any aircraft operational configuration | Executed only in some approved configurations |
| Examples | Lab debug monitor; ground maintenance mode inhibited in flight; unused functions of a reused RTOS or library | Single- vs twin-engine logic in one engine controller; sensor options selected by an aircraft personality module; customer-selectable features |
| The deactivation means | Needs requirements and tests; developed to the level of the active software | Needs requirements and tests; developed to the level of the active software |
| The deactivated code itself | Often treated like level E, but some requirements and testing are still recommended; higher if used for important maintenance decisions | Full DO-178C objectives at its software level, because it will fly in some configuration |
| Coverage resolution | Analysis and test showing it cannot be executed | Test in the configuration where it is active |
- —Plan it. Describe deactivated code in the PSAC (usually under additional considerations): types, category, mechanism and verification approach. Give developers direction in the SDP and verifiers in the SVP.
- —Design it (DO-178C
§5.2.4). The deactivation mechanism must stop deactivated code affecting active code, be considered in the safety assessment, and be verified. - —Choose robust mechanisms. Use multiple discrete pins or a checked configuration file rather than one pin that can short; combine signals (weight-on-wheels alone can be misread).
- —Compile-time removal (
#ifdef, smart linking) is acceptable, but if the compiler is not qualified, analyse the build output to confirm the code really is absent, and lock the build settings in the build procedures. - —Control it. Make sure future users cannot assume a deactivated library function is approved; release only the approved subset if necessary.
Worked example
Engine controller for one or two engines
A FADEC software load serves a single-engine and a twin-engine aircraft. The twin-only cross-engine synchronisation logic is category two deactivated code: it is selected by a coded configuration plug read at power-up, with a two-out-of-three pin vote and a parity check. The logic is developed and verified to level A, and tested in the twin configuration for full coverage. The single-engine test campaign shows it never executes when the plug says “single”. The plug-reading function, the vote and its failure modes are covered by requirements, tests and the safety assessment.
Pitfall
Category two downgraded to category one
A program plans optional features as category two, then runs out of time to verify them fully and quietly calls them category one. That can be acceptable only with authority agreement and firm controls so no future installer or developer believes the feature is approved for use.
Noncovered code in model-based development
Model-based development
Dead logic in models, unreachable states and generated code
DO-331 adds model coverage (see Model Coverage Analysis), which finds the model equivalent of noncovered code before any code exists. Formal dead logic detection goes further: it proves that some decision outcomes can never occur. On the helicopter reference project, the design-error-detection run on the flight control model reported six dead-logic objectives: in each of three actuator-control channels, a saturation block’s “input at or above the upper limit” outcome could never be true and its “input above the lower limit” outcome was always true, because upstream rate limits held the signal to ±0.1 while the saturation limits were wider. Typical model-level causes: Stateflow states with no reachable entry transition, switch conditions contradicted by upstream range constraints, and variant branches never selected.
Resolving a dead-logic finding in a model
Check the analysis assumptions
Dead logic may be an artefact of input range constraints or parameter values given to the analysis. Confirm they match the real interface requirements.
Classify it
Is it a modelling error (remove it), defensive logic required by the standard or safety analysis (keep it, justify it, verify it by analysis or robustness test), or a configuration variant (treat as deactivated)?
Fix at the model, not the code
Generated code reflects the model. Correct or justify at model level, regenerate, and confirm the change in the generated code and in code coverage.
Trace the effect into the code
Dead model logic usually becomes dead or unreachable code in the generated source; a code prover may flag it as grey/unreachable. The two analyses should agree.
Record the justification
Keep the classification and rationale with the model verification results so the code-level coverage gap is already explained.
Worked example
Defensive saturation: dead or required?
In the reference example, the saturation limit can never be reached today. If the saturation exists because the actuator command standard requires a hard limit regardless of upstream logic (a robustness requirement protecting against a future change or a fault upstream), it is required defensive logic: keep it, trace it to that requirement, and verify it by robustness testing with the upstream constraint removed or by analysis. If nobody can name a requirement for it, it is extraneous and should be removed.
What the auditor looks for
What the reviewer will ask
Show me the list of coverage gaps and how each was resolved. Which ones did you call dead, extraneous, deactivated or defensive, and where is the justification? For deactivated code, what is the mechanism, which level was it developed to, and where is it tested? Was anything removed after the for-score run, and what was re-verified? For level A, what did the compiler add? Any extraneous code still in the build must be in the SAS with the agreed plan.
Self-check
Coverage shows a block of code that runs only when a configuration file selects a second display format, which one airline uses. The code traces to requirements. What is it, and what is needed?