Example: null4.c

up: index
prev: null3.c
next: intptr2.c

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include <cheriintrin.h>
    
    int main()
    {
        unsigned char nullrepr0[sizeof(void*)] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
        unsigned char nullrepr1[sizeof(void*)] = {0,0,0,0,0,0,0,0,5,0,1,0,0,0,0,0};
        void *p0,*p1;
    
        for(unsigned int i=0;i<sizeof(void*);i++)
        {
            ((unsigned char*)&p0)[i]=nullrepr0[i];
            ((unsigned char*)&p1)[i]=nullrepr1[i];
        }
    
        if(cheri_is_equal_exact(p0,p1))
            fprintf(stderr,"p0 exactly equal p1\n");
        else
            fprintf(stderr,"p0 NOT exactly equal p1\n");
    }

Experimental data (what does this mean?)

gcc-morello-O3
cerberus-cheri
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia
cerberus-cheri-cornucopia-no-pnvi
 p0 exactly equal p1
 
gcc-morello-O0
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
cerberus-cheri-revocation
 p0 NOT exactly equal p1