Example: align2.c

up: index
prev: align1.c
next: align3.c

    #include <stdlib.h>
    #include <stdio.h>
    #include <stdalign.h>
    #include <cheriintrin.h>
    
    int main()
    {
        size_t sizes[] = {0,1,1000,0xffffff, (size_t)-1};
    
        for(unsigned int i=0;i<sizeof(sizes)/sizeof(size_t);i++)
        {
            size_t m = cheri_representable_alignment_mask(sizes[i]);
            size_t l = cheri_representable_length(sizes[i]);
            fprintf(stderr,"%zx:\t%zx,%zx\n",sizes[i],m,l);
        }
    }

Experimental data (what does this mean?)

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
 0: ffffffffffffffff,0
1: ffffffffffffffff,1
3e8: ffffffffffffffff,3e8
ffffff: ffffffffffff8000,1000000
ffffffffffffffff: ff80000000000000,0
 
gcc-morello-O0
gcc-morello-O3
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
cerberus-cheri
cerberus-cheri-no-pnvi
cerberus-cheri-revocation
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia
cerberus-cheri-cornucopia-no-pnvi
 0: ffffffffffffffff,0
1: ffffffffffffffff,1
3e8: ffffffffffffffff,3e8
ffffff: ffffffffffffe000,1000000
ffffffffffffffff: ffe0000000000000,0