Example: modptr1.c

up: index
prev: intptr12.c
next: modptr1a.c

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

Experimental data (what does this mean?)

cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi
 Original: (@disabled, 0xfffff24c [rwRW,0xfffff24c-0xfffff250])
Modified: (@disabled, 0xfffff22a [rwRW,0xfffff24c-0xfffff250] (notag))
 
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia
 Original: (@17, 0xfffff24c [rwRW,0xfffff24c-0xfffff250])
Modified: (@empty, 0xfffff22a [rwRW,0xfffff24c-0xfffff250] (notag))
 
clang-riscv-O3-bounds-subobject-safe Original: 0x104490 [rwRW,0x104490-0x104494]
Modified: 0x10442a [rwRW,0x104490-0x104494] (invalid)
 
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe
 Original: 0x104430 [rwRW,0x104430-0x104434]
Modified: 0x10442a [rwRW,0x104430-0x104434] (invalid)
 
clang-riscv-O3-bounds-conservative Original: 0x1044c0 [rwRW,0x1044c0-0x1044c4]
Modified: 0x10442a [rwRW,0x1044c0-0x1044c4] (invalid)
 
clang-riscv-O0-bounds-conservative
clang-riscv-O0-bounds-references-only
 Original: 0x1043f0 [rwRW,0x1043f0-0x1043f4]
Modified: 0x10432a [rwRW,0x1043f0-0x1043f4] (invalid)
 
clang-morello-O3-bounds-subobject-safe Original: 0x131560 [rwRW,0x131560-0x131564]
Modified: 0x13152a [rwRW,0x131560-0x131564] (invalid)
 
clang-morello-O3-bounds-conservative Original: 0x1315a0 [rwRW,0x1315a0-0x1315a4]
Modified: 0x13152a [rwRW,0x1315a0-0x1315a4] (invalid)
 
clang-morello-O0-bounds-conservative
clang-morello-O0-bounds-references-only
clang-morello-O0-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe
 Original: 0x131320 [rwRW,0x131320-0x131324]
Modified: 0x13132a [rwRW,0x131320-0x131324] (invalid)
 
gcc-morello-O3 Original: 0x4293a0 [rwRW,0x4293a0-0x4293a4]
Modified: 0x42932a [rwRW,0x4293a0-0x4293a4] (invalid)
 
gcc-morello-O0 Original: 0x429820 [rwRW,0x429820-0x429824]
Modified: 0x42982a [rwRW,0x429820-0x429824] (invalid)