Example: cast0.c

up: index
prev: exponent1.c
next: cast1.c

    int main()
    {
        int x=42;
        int *p = &x;
        char c = (char)p;
    }
    
        

Experimental data (what does this mean?)

cerberus-cheri
cerberus-cheri-no-pnvi
cerberus-cheri-revocation
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia
cerberus-cheri-cornucopia-no-pnvi
 exit codes: compile 0 / execute 1 Undefined {ub: "UB024_out_of_range_pointer_to_integer_conversion", loc: "<5:14--5:21>"}
 
clang-morello-O0-bounds-conservative
clang-morello-O3-bounds-conservative
clang-morello-O0-bounds-references-only
clang-morello-O0-bounds-subobject-safe
clang-morello-O3-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe
clang-riscv-O0-bounds-conservative
clang-riscv-O3-bounds-conservative
clang-riscv-O0-bounds-references-only
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O3-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe
 tests/cheri/cast0.c:5:14: warning: cast to smaller integer type 'char' from 'int *' [-Wpointer-to-int-cast]
char c = (char)p;
^~~~~~~
1 warning generated.
 
gcc-morello-O0
gcc-morello-O3
 tests/cheri/cast0.c: In function 'main':
tests/cheri/cast0.c:5:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
5 | char c = (char)p;
| ^