Alex Coplan writes: > Secondly, I wanted to clarify the situation with respect to explicit > casts; that is, those conversions allowed by gcc_jit_context_new_cast(). > The docs [0] say: > > Currently only a limited set of conversions are possible: > - int <-> float > - int <-> bool > - P* <-> Q*, for pointer types P and Q > > However, empirically (at least on aarch64), libgccjit appears to allow > me to compile casts between any pair of types in the following set > without any complaint: > > { > SIGNED_CHAR, > UNSIGNED_CHAR, > SHORT, > UNSIGNED_SHORT, > INT, > UNSIGNED_INT, > LONG, > UNSIGNED_LONG, > LONG_LONG, > UNSIGNED_LONG_LONG > } Hi Alex, Looking at the code I believe all these casts are meant to be supported (read your intuition was correct). Also IMO source of confusion is that the doc is mentioning 'int' and 'float' but I believe would be better to have like 'integral' and 'floating-point' to clearly disambiguates with respect to the C types. AFAIU the set of supported casts should be like: integral <-> integral floating-point <-> floating-point integral <-> floating-point integral <-> bool P* <-> Q* for pointer types P and Q. I'd propose to install the following patch to make doc and comments homogeneous at documenting what do we accept, and I guess we should just consider bugs if some of these conversions is not handled correctly or leads to ICE. Bests Andrea gcc/jit/ChangeLog 2020-07-21 Andrea Corallo * docs/_build/texinfo/libgccjit.texi (Type-coercion): Improve doc on allowed type casting. * docs/topics/expressions.rst (gccjit::context::new_cast) (gcc_jit_context_new_cast): Likewise. * libgccjit.c: Improve comment on allowed type casting. * libgccjit.h: Likewise