AutosarC++19_03-A12.0.2

Bitwise operations and operations that assume data representation in memory shall not be performed on objects

Required inputs: IR

Possible Messages

Key

Text

Severity

Disabled

disallowed_memcmp_pointer_arg

Disallowed type of pointer argument.

None

False

invalid_memset

memset shall not be used with non-trivially default constructible types.

None

False

memcmp_char_pointer_arg

memcmp shall not be used with char pointer argument, use strncmp instead.

None

False

memcmp_float

memcmp shall not be used to compare floats as the same value may be stored using different representations.

None

False

memcmp_padding

memcmp shall not be used to compare structs with padding.

None

False

memcmp_struct_pointer_arg

memcmp shall not be used with struct pointer argument as it would compare padding as well.

None

False

memcmp_union_pointer_arg

memcmp shall not be used with union pointer argument as it would compare padding and different kinds of representation.

None

False

partial_memory_operation

Memory operation shall not use a size smaller than sizeof the object type.

None

False

pointer_arithmetic_on_object

Memory operation shall not be performed on pointer arithmetic applied to object addresses.

None

False

Options

allow_aggregates_with_nsdmi

allow_aggregates_with_nsdmi : bool = True

Whether to allow memset usage with aggregates that are not trivially default constructible only because of a default non-static data member initializer (NSDMI).
 

allow_char

allow_char : bool = True

Whether to allow memcmp on char type.
 

allow_composites_without_padding

allow_composites_without_padding : bool = True

Whether to allow using memcmp on structs and unions that have no padding bytes.
 

allow_float

allow_float : bool = False

Whether to allow memcmp on floating point types.
 

functions

functions : set[bauhaus.analysis.config.QualifiedName] = {'memcmp'}

Names of functions being relevant as call targets for this check.
 

ignore_calls_in_functions

ignore_calls_in_functions : set[bauhaus.analysis.config.QualifiedName] = set()

Qualified names of function definitions in which calls to relevant functions are ignored for this check.
 

relevant_memory_functions

relevant_memory_functions : set[bauhaus.analysis.config.QualifiedName] = {'memcmp', 'memcpy', 'memmove', 'memset'}

Names of memory functions being relevant as call targets for this check.
 

relevant_memset_functions

relevant_memset_functions : set[bauhaus.analysis.config.QualifiedName] = {'memset'}

Names of memset-like functions being relevant as call targets for this check.