Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC++2008-0-1-2_a

In this section:
Synopsis

(Required) A project shall not contain infeasible paths.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

The condition in if, for, while, do-while statement sequences and the ternary operator is always met. This check is identical to RED-cond-always, MISRAC2012-Rule-14.3_a, MISRAC++2023-0.0.2_a.

Coding standards
CERT EXP17-C

Do not perform bitwise operations in conditional expressions

MISRA C:2012 Rule-14.3

(Required) Controlling expressions shall not be invariant

MISRA C++ 2023 0.0.2

(Advisory) Controlling expressions should not be invariant

Code examples

The following code example fails the check and will give a warning:

void example(void) {

    int x = 5;

    for (x = 0; x < 6 && 1; x--) {
    }
}

The following code example passes the check and will not give a warning about this issue:

void example(void) {

    int x = 5;

    for (x = 0; x < 6 && 1; x++) {
    }
}