Example: intptr11a.c

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

    #include <stdio.h>
    
    int main()
    {
        void (*f)(int) = (void (*)(int))-1;
        unsigned long x = (unsigned long)f;
    
        fprintf(stderr,"Ptr %s\n",  (x==-1?"eq":"neq"));
    }

Experimental data (what does this mean?)

cerberus-cheri
cerberus-cheri-no-pnvi
cerberus-cheri-revocation
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia
cerberus-cheri-cornucopia-no-pnvi
 Ptr eq
 
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
 tests/cheri/intptr11a.c:8:35: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
fprintf(stderr,"Ptr %s\n", (x==-1?"eq":"neq"));
~^ ~~
1 warning generated.
Ptr eq
 
gcc-morello-O0
gcc-morello-O3
 tests/cheri/intptr11a.c: In function 'main':
tests/cheri/intptr11a.c:8:35: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'int' [-Wsign-compare]
8 | fprintf(stderr,"Ptr %s\n", (x==-1?"eq":"neq"));
| ^~
Ptr eq