Example: modptr1a.c

up: index
prev: modptr1.c
next: modptr2.c

    #include <stdio.h>
    #include "capprint.h"
    
    int x=0;
    int *px = &x;
    
    int main(void)
    {
        fprintf(stderr,"Original %" PTR_FMT "\n", sptr((void*)px));
        unsigned char *p = (unsigned char*) &px;
        p[0] = p[0];
        fprintf(stderr,"Modified %" PTR_FMT "\n", sptr((void*)px));
        fprintf(stderr,"%d\n",*px);
    }

Experimental data (what does this mean?)

cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi
 exit codes: compile 0 / execute 1 Undefined {ub: "UB_CHERI_UndefinedTag", loc: "<13:29--13:32>"}
Original (@disabled, 0xfffff24c [rwRW,0xfffff24c-0xfffff250])
Modified (@disabled, 0xfffff24c [rwRW,0xfffff24c-0xfffff250] (notag))
 
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia
 exit codes: compile 0 / execute 1 Undefined {ub: "UB_CHERI_UndefinedTag", loc: "<13:29--13:32>"}
Original (@17, 0xfffff24c [rwRW,0xfffff24c-0xfffff250])
Modified (@17, 0xfffff24c [rwRW,0xfffff24c-0xfffff250] (notag))
 
clang-riscv-O3-bounds-subobject-safe Original 0x1044e0 [rwRW,0x1044e0-0x1044e4]
Modified 0x1044e0 [rwRW,0x1044e0-0x1044e4]
0
 
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe
 Original 0x104480 [rwRW,0x104480-0x104484]
Modified 0x104480 [rwRW,0x104480-0x104484]
0
 
clang-riscv-O3-bounds-conservative Original 0x104510 [rwRW,0x104510-0x104514]
Modified 0x104510 [rwRW,0x104510-0x104514]
0
 
clang-riscv-O0-bounds-conservative
clang-riscv-O0-bounds-references-only
 Original 0x104440 [rwRW,0x104440-0x104444]
Modified 0x104440 [rwRW,0x104440-0x104444]
0
 
clang-morello-O3-bounds-subobject-safe Original 0x1315a0 [rwRW,0x1315a0-0x1315a4]
Modified 0x1315a0 [rwRW,0x1315a0-0x1315a4]
0
 
clang-morello-O0-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe
 Original 0x1313a0 [rwRW,0x1313a0-0x1313a4]
Modified 0x1313a0 [rwRW,0x1313a0-0x1313a4]
0
 
clang-morello-O3-bounds-conservative Original 0x1315e0 [rwRW,0x1315e0-0x1315e4]
Modified 0x1315e0 [rwRW,0x1315e0-0x1315e4]
0
 
clang-morello-O0-bounds-conservative
clang-morello-O0-bounds-references-only
 Original 0x131360 [rwRW,0x131360-0x131364]
Modified 0x131360 [rwRW,0x131360-0x131364]
0
 
gcc-morello-O3 Original 0x429420 [rwRW,0x429420-0x429424]
Modified 0x429420 [rwRW,0x429420-0x429424]
0
 
gcc-morello-O0 exit codes: compile 0 / execute 137 Original 0x4298e0 [rwRW,0x4298e0-0x4298e4]
Modified 0x4298e0 [rwRW,0x4298e0-0x4298e4] (invalid)