9#ifndef MAXOS_RUNTIME_UBSAN_H
10#define MAXOS_RUNTIME_UBSAN_H
15#define ubsan_aligned(value, alignment) !(value & (alignment - 1))
17namespace MaxOS::runtime {
63 } type_mismatch_info_t;
79 } type_mismatch_info_v1_t;
108 } shift_out_of_bounds_info_t;
123 } out_of_bounds_info_t;
136 } location_only_info_t;
150 } invalid_value_info_t;
164 } vla_bound_not_positive_info_t;
170 "reference binding to",
171 "member access within",
173 "constructor call on",
177 "cast to virtual base of",
Handles undefined behaviour sanitizer runtime errors.
static void handle(source_location_t location, const char *msg)
Handles the UBSan error (currently only printing the location and panicking)
static void print_type_mismatch(type_mismatch_info_t *info, uintptr_t ptr)
Prints the type mismatch error for UBSan.
static void print_type_mismatch_v1(type_mismatch_info_v1_t *info, uintptr_t ptr)
Prints the type mismatch error for UBSan v1.
Information about an invalid value error.
type_descriptor_t * type
The type of the invalid value.
source_location_t location
The location of the invalid value.
Information that an error that only has a location.
source_location_t location
The location of the error.
Information about an out of bounds error.
type_descriptor_t * array_type
The type of the array.
type_descriptor_t * index_type
The type of the index.
source_location_t location
The location of the out of bounds access.
Information about an overflow error.
source_location_t location
The location of the overflow.
type_descriptor_t * base_type
The base type of the operation.
Information about a shift out of bounds error.
source_location_t location
The location of the shift out of bounds.
type_descriptor_t * left_type
The type of the left operand.
type_descriptor_t * right_type
The type of the right operand.
The location in the source code where the undefined behaviour occurred.
uint32_t line
The line number in the source file.
uint32_t column
The column number in the source file.
const char * file
The name of the source file.
Describes a type in the program.
uint16_t kind
The kind of type (e.g., struct, class, union)
char name[]
The name of the type.
uint16_t info
Additional type information.
Information about a type mismatch error (version 1)
source_location_t location
The location of the type mismatch.
unsigned char log_alignment
The log2 of the required alignment.
unsigned char type_check_kind
The kind of type check that failed.
type_descriptor_t * type
The type that was expected.
Information about a type mismatch error.
source_location_t location
The location of the type mismatch.
uint8_t type_check_kind
The kind of type check that failed.
uintptr_t alignment
The required alignment.
type_descriptor_t * type
The type that was expected.
Information about a VLA bound not positive error.
type_descriptor_t * type
The type of the VLA bound.
source_location_t location
The location of the VLA bound not positive.
const char * TYPE_CHECK_KINDS[]
List of type check errors.