FaultDetection-BadEnumValue

Only assign values corresponding to the enumerators to an expression of enumeration type

Required inputs: IR, StaticSemanticAnalysis

This check detects assignments to enum variables where the assigned value does not correspond to any enumerator of the enum type.

Possible Messages

Key

Text

Severity

Disabled

asgn_interval_not_an_enumerator

Possible assignment of value which does not correspond to an enumerator (values computed by the analysis are [{int1};{int2}], they contain e.g. {int0} which does not correspond to an enumerator)

None

False

asgn_interval_out_of_enum_range

Possible assignment of value outside the enumerators (values computed by the analysis are [{int0};{int1}])

None

False

asgn_not_an_enumerator

Assignment of value {int0} which does not correspond to an enumerator

None

False

asgn_out_of_enum_range

Assignment of value {int0} outside the range of the enumerators

None

False

Options

any_enum

any_enum : bool = True

Whether to check any enumeration. If false, scoped or enumerations based on a fixed type are not checked.
 

with_predicate_analysis

with_predicate_analysis : bool = True

For enum assignment check, use an additional analysis step based on predicate abstraction for the analysis of enum values. It can reduce the number of false positives, but is potentially costly.