Miscellaneous-NoMixOfPtrAndIntArithmetic

Do not mix pointer and integer arithmetic

Required inputs: IR

This rule will warn when pointers are converted to integers.

Possible Messages

Key

Text

Severity

Disabled

cast_changes_type_category

Conversion of pointer type to integer type.

None

False

Options

category_changes

category_changes

Type: list[typing.Tuple[typing.Set[bauhaus.ir.common.types.type_systems.TypeCategory], typing.Set[bauhaus.ir.common.types.type_systems.TypeCategory]]]

Default: [({'function_pointer_types', 'incomplete_pointer_types', 'null_pointer_types', 'object_pointer_types', 'void_pointer_types'}, {'signed_types', 'unsigned_types'})]

List of (from, to) type category pairs to check for. Both from and to are sets of categories.
 

check_explicit_casts

check_explicit_casts : bool = True

Whether explicit casts should be checked and reported.
 

check_implicit_casts

check_implicit_casts : bool = True

Whether implicit casts should be checked and reported.
 

look_through_casts

look_through_casts : bool = False

If true, operand after stripping casts is used.
 

only_complex_expressions

only_complex_expressions : bool = False

Whether all operands or only those deemed complex should be inspected.
 

show_operand_in_entity

show_operand_in_entity : bool = False

Whether entity should be "from->to" or "(from->to)operand".
 

type_system

type_system : bauhaus.ir.common.types.type_systems.TypeSystem = <bauhaus.ir.common.types.type_systems.CompilerTypeSystem object at 0x7f6f1c5fd510>

Which type system to use: compiler types, underlying types, essential types.
 

Option Types

These types are used by options listed above:

TypeCategory

Base class for the different type categories.
 

signed_types

unsigned_types

float_types

char_types

plain char.

bool_types

bool, _Bool and special expressions.

enum_types

void_types

void_pointer_types

incomplete_pointer_types

function_pointer_types

object_pointer_types

null_pointer_types

other_types

Those not covered by other categories.