CTSRD-CHERI / clang

DO NOT USE. Use llvm-project instead
Other
9 stars 8 forks source link

__cheri_tocap doesn't understand that static array are pointers #179

Closed brooksdavis closed 6 years ago

brooksdavis commented 6 years ago
void
func(void)
{
        char buf[1];    
        char * __capability bufp;

        bufp = (__cheri_tocap char * __capability) buf;
}

Compiled with:

clang -c -target cheri-unknown-freebsd -mabi=64 -cheri=128 foo.c

I get:

foo.c:7:45: error: invalid source type 'char [1]' for __cheri_tocap: source must
      be a pointer
        bufp = (__cheri_tocap char * __capability) buf;
                                                   ^
1 error generated.

This require silly workarounds like &buf[0].