Skip to content

RULE-10-4: False negatives as rule does not currently consider ternaries #821

Open
@MichaelRFairhurst

Description

@MichaelRFairhurst

Affected rules

  • RULE-10-4

Description

The text states that the rule applies to usual arithmetic conversions, and the c spec states that for a ? b : c the usual arithmetic conversions are performed on operands b and c. However, OperationWithUsualArithmeticConversions from MisraExpressions.qll holds for this instanceof BinaryOperation and ... or this instanceof AssignArithmeticOperation, it should also hold for this instanceof ConditionalExpr and getLeftOperand() / getRightOperand() should return operands 2 & 3.

Example

void example_function() {
  int x;
  float y;
  bool b;

  b ? x : y; // FALSE NEGATIVE
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty-LowA false positive or false negative report which is expected to take <1 day effort to addressImpact-LowStandard-MISRA-Cfalse positive/false negativeAn issue related to observed false positives or false negatives.false-negativeAn issue representing a false negative report.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions