Skip to content

Unreachable return statement after #endif #210

@Symanyshyn-IFX

Description

@Symanyshyn-IFX

Several source files contain an early return inside a preprocessor #if/#else block, making the final return statement after #endif unreachable dead code.
IAR Compiler reports this as: Warning[Pe111]: statement is unreachable

The pattern is the same: one preprocessor branch returns early, but a second return sits
after #endif where it can never be reached.

Affected files:

return ARM_CMSIS_NN_SUCCESS;




Example (arm_convolve_even_s4.c):

#if defined(ARM_MATH_MVEI)
    // ... main implementation ...
#else
    (void)ctx;
    // ...
    return ARM_CMSIS_NN_NO_IMPL_ERROR;  // early return in #else branch
#endif

    return ARM_CMSIS_NN_SUCCESS;        // unreachable

Suggested fix:

Ensure each preprocessor branch has its own return, and remove the one after #endif:

#if defined(ARM_MATH_MVEI)
    // ... main implementation ...
    return ARM_CMSIS_NN_SUCCESS;
#else
    (void)ctx;
    // ...
    return ARM_CMSIS_NN_NO_IMPL_ERROR;
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions