Example: exponent1.c

up: index
prev: unrep2.c
next: cast0.c

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include <cheriintrin.h>
    
    #include "capprint.h"
    
    int main()
    {
        // https://www.morello-project.org/capinfo?c=0x1fc000000333800070000000012342222
        unsigned char repr[sizeof(void*)] = {0x22, 0x22, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x38, 0x33, 0x00, 0x00, 0x00, 0xfc};
        void *p;
        memcpy(&p, repr, sizeof(void*));
        
        fprintf(stderr,"%s\n", sptr(p));
    
        size_t len = cheri_length_get(p);
        fprintf(stderr,"len = %zx\n", len);
    }

Experimental data (what does this mean?)

cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi
 (@disabled, 0x12342222 [rwxRW,0x0-0x10000000000000000] (notag))
len = ffffffffffffffff
 
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia
 (@empty, 0x12342222 [rwxRW,0x0-0x10000000000000000] (notag))
len = ffffffffffffffff
 
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
 0x12342222 [,0x0-0xe700000000000000] (invalid,sealed)
len = e700000000000000
 
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
 0x12342222 [rwxRW,0x0-0xffffffffffffffff] (invalid)
len = ffffffffffffffff
 
gcc-morello-O0
gcc-morello-O3
 0x12342222 [rwxRWE,0x0-0xffffffffffffffff] (invalid)
len = ffffffffffffffff