Open
@MichaelRFairhurst

Description

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
}