Closed brooksdavis closed 6 years ago
Currently the non-CHERI behaviour for clang
is to output a warning (-Wpointer-sign
). Would it be OK to output a warning when doing this sort of capability promotion so that it is consistent?
The -Wpointer-sign
warning is also what is output in the purecap
ABI:
test.c:3:23: warning: initializing 'long * __capability' with an expression of type 'unsigned long * __capability' converts between pointers to integer
types with different sign [-Wpointer-sign]
That could work since we could suppress the warning when we don't want it.
We also don't currently support promotion in the same-signed case or more generally where the pointee types are the same. Is this something that we should be allowing? Or allow but output a warning?
In case the implied context wasn't clear, the warning is on the &tmp
. I'd tried changing that argument to be a capability for consistency.
In this case, fueword_c is called with a mix if signs and since it's doing
ld
it's not actually doing anything sign-dependent. I can work around this with casts but there are going to be a lot of them.