eq2.c
up: index
prev: eq1.c
next: eq3.c
#include <stdio.h>
#include <cheriintrin.h>
#include "capprint.h"
void func(int x) {}
int main(void)
{
void (*fptr1)(int) = cheri_tag_clear(&func);
void (*fptr2)(int) = cheri_tag_clear(&func);
fprintf(stderr,"P1: %" PTR_FMT "\n", sptr((void*)fptr1));
fprintf(stderr,"P1: %" PTR_FMT "\n", sptr((void*)fptr2));
fprintf(stderr,"Exact %s\n", cheri_is_equal_exact(fptr1,fptr2)?"eq":"neq");
fprintf(stderr,"(==) %s\n", fptr1==fptr2?"eq":"neq");
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi P1: (@disabled, 0x100000386 [rxR,0x100000386-0x100000388] (invalid,sentry))
P1: (@disabled, 0x100000386 [rxR,0x100000386-0x100000388] (invalid,sentry))
Exact eq
(==) eq
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia P1: (@empty, 0x100000386 [rxR,0x100000386-0x100000388] (invalid,sentry))
P1: (@empty, 0x100000386 [rxR,0x100000386-0x100000388] (invalid,sentry))
Exact eq
(==) eq
clang-riscv-O3-bounds-subobject-safe P1: 0x10204c [rxR,0x100000-0x104560] (invalid,sentry,capmode)
P1: 0x10204c [rxR,0x100000-0x104560] (invalid,sentry,capmode)
Exact eq
(==) eq
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe P1: 0x10202a [rxR,0x100000-0x1045a0] (invalid,sentry,capmode)
P1: 0x10202a [rxR,0x100000-0x1045a0] (invalid,sentry,capmode)
Exact eq
(==) eq
clang-riscv-O3-bounds-conservative P1: 0x10206e [rxR,0x100000-0x1045a0] (invalid,sentry,capmode)
P1: 0x10206e [rxR,0x100000-0x1045a0] (invalid,sentry,capmode)
Exact eq
(==) eq
clang-riscv-O0-bounds-conservative
clang-riscv-O0-bounds-references-only P1: 0x10200a [rxR,0x100000-0x104560] (invalid,sentry,capmode)
P1: 0x10200a [rxR,0x100000-0x104560] (invalid,sentry,capmode)
Exact eq
(==) eq
clang-morello-O3-bounds-subobject-safe P1: 0x111041 [rxR,0x100000-0x131640] (invalid,sentry)
P1: 0x111041 [rxR,0x100000-0x131640] (invalid,sentry)
Exact eq
(==) eq
clang-morello-O0-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe P1: 0x110e71 [rxR,0x100000-0x131440] (invalid,sentry)
P1: 0x110e71 [rxR,0x100000-0x131440] (invalid,sentry)
Exact eq
(==) eq
clang-morello-O3-bounds-conservative P1: 0x111091 [rxR,0x100000-0x131680] (invalid,sentry)
P1: 0x111091 [rxR,0x100000-0x131680] (invalid,sentry)
Exact eq
(==) eq
clang-morello-O0-bounds-conservative
clang-morello-O0-bounds-references-only P1: 0x110e51 [rxR,0x100000-0x131440] (invalid,sentry)
P1: 0x110e51 [rxR,0x100000-0x131440] (invalid,sentry)
Exact eq
(==) eq
gcc-morello-O3 tests/cheri/eq2.c: In function 'main':
tests/cheri/eq2.c:12:47: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
12 | fprintf(stderr,"P1: %" PTR_FMT "\n", sptr((void*)fptr1));
| ^
tests/cheri/eq2.c:13:47: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
13 | fprintf(stderr,"P1: %" PTR_FMT "\n", sptr((void*)fptr2));
| ^
P1: 0x403051 [rxRE,0x400000-0x427280] (invalid,sentry)
P1: 0x403051 [rxRE,0x400000-0x427280] (invalid,sentry)
Exact eq
(==) eq
gcc-morello-O0 tests/cheri/eq2.c: In function 'main':
tests/cheri/eq2.c:12:47: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
12 | fprintf(stderr,"P1: %" PTR_FMT "\n", sptr((void*)fptr1));
| ^
tests/cheri/eq2.c:13:47: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
13 | fprintf(stderr,"P1: %" PTR_FMT "\n", sptr((void*)fptr2));
| ^
P1: 0x403845 [rxRE,0x400000-0x427740] (invalid,sentry)
P1: 0x403845 [rxRE,0x400000-0x427740] (invalid,sentry)
Exact eq
(==) eq